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
Contributor
Posts: 10
Registered: ‎03-28-2012
My Device: Torch 9810
My Carrier: Rogers

Variable results for BasicEditFields.getContentHeight()

I'm working on a GUI having some BasicEditFields.

 

The screen has several Manager's, buttons and so forth.

 

After changing the text of the field, getContentHeight() returns a larger value.

 

I have specified padding and font, but the content height changes with the text field.

 

Is there any way to have a fix size for my BasicEditField that will not vary according to the text content?

Developer
Posts: 304
Registered: ‎08-01-2008
My Device: Not Specified

Re: Variable results for BasicEditFields.getContentHeight()

BasicEditField's height will change if text is longer than one line. If you want a fixed display height add it inside a fixed height manager.

Contributor
Posts: 10
Registered: ‎03-28-2012
My Device: Torch 9810
My Carrier: Rogers

Re: Variable results for BasicEditFields.getContentHeight()

In this case, the text changes are all within 1 line of text.

Contributor
Posts: 10
Registered: ‎03-28-2012
My Device: Torch 9810
My Carrier: Rogers

Re: Variable results for BasicEditFields.getContentHeight()

Also, it is not possible to override getContentHeight() (it's marked as final).

Overriding getPreferredHeight() gives me the same problem: my preferences are ignored and the BasicEditField getContentHeight() returns a variable value. (Sometimes 37, sometimes 38)

 

Developer
Posts: 304
Registered: ‎08-01-2008
My Device: Not Specified

Re: Variable results for BasicEditFields.getContentHeight()

What about getHeight method? does that also give different value?

 

You can fix the height of the field by overriding layout method.