Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
Posts: 5,339
Registered: 09-20-2008

Re: Multi-Line ButtonField

oops, sorry for mistake.

 

This method is available for Screen class.

 

 

Take your attention on paint() and drawFocus() methods.

 

Probably drawFocus() knows about one-line button. Tell to this method that button now is multi-lined.

 

Also I would recommend you to avoid use of fixed numbers in

public int getPreferredHeight()

 

 

It is better to calculate the height via Font class and getHeight() method of this class.

 

Otherwise if a user changes Font size via Options-Keyboard your application will show wrong picture.

 

Tbilisoft Team
BlackBerry Utilities For Everyday Life
main site: http://www.tbilisoft.com
site for mobile users: http://www.tbilisoft.mobi
Please use plain text.
Developer
dognose
Posts: 51
Registered: 11-27-2008

Re: Multi-Line ButtonField

Yeah your right...

 

I have to change many many things in my app depending on enviroment values. But for this "beta-Version" i think dealing with fixed values is okay....

 

Any idea, how to override the "onClick-draw-style" of a button... ?

 

have tried a little workarround using a boolean flag, paint and navigationClick-method, but it seems,

that the default "buttons-currently-clicked-style" is dominating....

 

dognose

Please use plain text.
Developer
Posts: 5,339
Registered: 09-20-2008

Re: Multi-Line ButtonField

Have you overridden the following method:

 

protected void drawFocus(Graphics graphics, boolean on)

 

it invokes when the the field gains focus, i.e you click on it.

Tbilisoft Team
BlackBerry Utilities For Everyday Life
main site: http://www.tbilisoft.com
site for mobile users: http://www.tbilisoft.mobi
Please use plain text.
Developer
dognose
Posts: 51
Registered: 11-27-2008

Re: Multi-Line ButtonField

[ Edited ]

i override that one, thought is represents the "selected" style....

 

and in my case, the button changes style fine, if i "select" it.

but if i "click" on it, it falls back do the "default Button-Is-Currently-Clicked" Style...

 

here some pics of what i'm trying to say:

 

status downwards:

button default

button selected

button currently clicked

 

 --

 

cheers,

dognose

Message Edited by dognose on 11-30-2008 02:55 PM
Please use plain text.
Developer
Posts: 5,339
Registered: 09-20-2008

Re: Multi-Line ButtonField

I understand.

 

In this case try to avoid inheritance from ButtonField and extend Field class directly.

Tbilisoft Team
BlackBerry Utilities For Everyday Life
main site: http://www.tbilisoft.com
site for mobile users: http://www.tbilisoft.mobi
Please use plain text.
Developer
dognose
Posts: 51
Registered: 11-27-2008

Re: Multi-Line ButtonField

sounds logical.... okay, i change my code.

 

For thos who are interessted in this solution too:

 

if you want to use a field as a button, you have to implement the layout() method to your class

extending field.

navigationClick() method should notify your Changelistener and return true.

 

cheers,

dognose

Please use plain text.