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
Developer
Sakberry
Posts: 248
Registered: ‎11-23-2009
Accepted Solution

What should getHeight return?

Hi

 

i am working on the torch simulator. the getwidth method return 360 which i know is correct but the getwidth returns 1073741823. Isnt it supposed to return 480??

can anyone tell me why does this happen and how can i resolve it?

Thanks

Please use plain text.
Developer
mtatro
Posts: 105
Registered: ‎06-23-2010
My Carrier: vodaphone

Re: What should getHeight return?

In my experience this generally happens on controls that have not been laid out yet. If you want the height of the screen, not the control, then call Display.getHeight()

 

 

-matt

Press Kudos if this helped - ;-)
Please use plain text.
Regular Contributor
jkoorts
Posts: 71
Registered: ‎03-18-2009

Re: What should getHeight return?

yup thats the value of the height of the field BEFORE layout. call childlayout(field, getPreferredWidth(), getPreferredHeight())  then check the height again - it should be something more sensible.

 

Note you have to override getPreferredWith() and getPreferredHeight() as well

 

Please use plain text.
Developer
sonicboomboy
Posts: 465
Registered: ‎03-04-2009
My Carrier: some

Re: What should getHeight return?

well, if you manager has USE_ALL_HEIGHT style, then it might return that value.
Got resolved! Press kudo icon!
Please use plain text.
Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Carrier: various

Re: What should getHeight return?

 


Sakberry wrote:

Hi

 

i am working on the torch simulator. the getwidth method return 360 which i know is correct but the getwidth returns 1073741823. Isnt it supposed to return 480??

can anyone tell me why does this happen and how can i resolve it?

Thanks


 

You are asking the wrong question. The question you should be asking is "Where can I fit the field which is 0x3FFFFFFF=Integer.MAX_VALUE >> 1 high?" Of course, not anywhere on the screen. So what entity might think it's got that much height available for displaying something? And the answer is "A vertically scrolling manager". Where did you get that manager from? Read this knowledge base article to find out:

MainScreen explained

So there is either nothing to "resolve" (because it's not a problem - it is a perfectly valid behaviour) or a simple NO_VERTICAL_SCROLL flag to add to your MainScreen.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Please use plain text.
Developer
sonicboomboy
Posts: 465
Registered: ‎03-04-2009
My Carrier: some

Re: What should getHeight return?

@arkadyz
great explanation, man!
Got resolved! Press kudo icon!
Please use plain text.
Developer
swap_chau
Posts: 179
Registered: ‎06-15-2011
My Carrier: Vodaphone

Re: What should getHeight return?

I think you can use getHeight(). It will only work if the button is already drawn.
Please use plain text.