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
RapsFan
Posts: 442
Registered: ‎08-02-2010
My Device: Z10
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
YamilBracho
Posts: 713
Registered: ‎05-31-2010
My Device: 8520

Re: Contextual popup on LabelField

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

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

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
YamilBracho
Posts: 713
Registered: ‎05-31-2010
My Device: 8520

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
RapsFan
Posts: 442
Registered: ‎08-02-2010
My Device: Z10

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
mreed
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
YamilBracho
Posts: 713
Registered: ‎05-31-2010
My Device: 8520

Re: Contextual popup on LabelField

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

Developer
simon_hain
Posts: 16,359
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

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
RapsFan
Posts: 442
Registered: ‎08-02-2010
My Device: Z10

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 :smileyhappy: