04-23-2011 02:13 AM
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
Solved! Go to Solution.
04-23-2011 03:02 AM
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()
04-23-2011 06:09 AM
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
04-23-2011 06:09 PM
04-24-2011 01:48 AM
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:
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.
04-24-2011 04:46 AM
07-02-2012 06:09 AM