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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
Bamaco
Posts: 10
Registered: ‎03-28-2012
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?

Please use plain text.
Developer
adwiv
Posts: 259
Registered: ‎08-01-2008

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.

Please use plain text.
Contributor
Bamaco
Posts: 10
Registered: ‎03-28-2012
My Carrier: Rogers

Re: Variable results for BasicEditFields.getContentHeight()

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

Please use plain text.
Contributor
Bamaco
Posts: 10
Registered: ‎03-28-2012
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)

 

Please use plain text.
Developer
adwiv
Posts: 259
Registered: ‎08-01-2008

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.

Please use plain text.