Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 442
Registered: ‎08-02-2010
My Device: Z10
My Carrier: Telus
Accepted Solution

Contextual popup on LabelField

Hi everyone. I'm going to try to explain what I want to do and maybe someone can tell me if it's possible and how to go about it. I'm assuming I would need to override the paint().

 

I have several label fields created like this:

 

  vManLeft.add(new LabelField(TX.getName(),Field.FOCUSABLE));
  vManLeft.add(new LabelField(FL.getName(),Field.FOCUSABLE));
  vManLeft.add(new LabelField(IL.getName(),Field.FOCUSABLE));
  vManLeft.add(new LabelField(PA.getName(),Field.FOCUSABLE));
  vManLeft.add(new LabelField(OH.getName(),Field.FOCUSABLE));
  vManLeft.add(new LabelField(MI.getName(),Field.FOCUSABLE));

 

Now TX, FL etc represents a state object and getName is self explanatory. In addition to name the State object also has methods for setting and getting population etc. I want to display a small window like popup with info like population, etc. when the label is highlighted.

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Contextual popup on LabelField

I guess your are tlaking about a tooltip. If so, please check http://www.naviina.eu/wp/blackberry/390/

Highlighted
Developer
Posts: 442
Registered: ‎08-02-2010
My Device: Z10
My Carrier: Telus

Re: Contextual popup on LabelField

Thanks Yamil that's what I was looking for. I'm having a problem adding the tooltip string to a field that is first added to a manager.

 

The method add(Field) in the type Manager is not applicable for the arguments (LabelField, String, long)


I extended the ToolTip class instead of MainScreen and added the label like this:

 

LabelField label = new LabelField();
vManLeft.add(label,"test", Field.FOCUSABLE);
  

How can I get the ToolTip code to work on fields within a manager?  

 

 

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Contextual popup on LabelField

Change to :

 

 

LabelField label = new LabelField("", Fields.FOCUSABLE);
vManLeft.add(label,"test");

 

the second parameter in the add is the message tooltip

 

Developer
Posts: 442
Registered: ‎08-02-2010
My Device: Z10
My Carrier: Telus

Re: Contextual popup on LabelField

No dice. The verticalmanager is only accepting the label param, not the tooltip string.

 

LabelField label = new LabelField("", Field.FOCUSABLE);
 vManLeft.add(label, "Test");

 

The error message is:

The method add(Field) in the type Manager is not applicable for the arguments (LabelField, String)

 

 

Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Contextual popup on LabelField

Make sure your vManLeft is casted to whatever class has the additional add() method.

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Contextual popup on LabelField

You have to add you field directly to the TooltipScreen (who inherits from MainScreen).

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Contextual popup on LabelField

i would suggest that you try to understand the code you are copy&pasting first.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 442
Registered: ‎08-02-2010
My Device: Z10
My Carrier: Telus

Re: Contextual popup on LabelField

Thanks everyone for the help. I'm combing through the ToolTip code now and am confident I can take it from here. Thanks Smiley Happy