tags:

views:

105

answers:

2

I want to display MapField on Storm on Full Screen and for this i am using MapField.setPreferredSize(Display.getWidth,Display.getHeight) . But instead of seeing MapField of dimensions 320X480 ,i get MapField of dimensions of roughly 320X280 and remaining space(480-280 = 200) filled with black colour..I have crosschecked values of Display.getWidth() and Display.getHeight(320 , 480)

+1  A: 

It sounds like your application is running in compatibility mode. You can check this using Application#isInTouchCompatibilityMode(). Touch Compatibility Mode fixes the drawable region of the Storms to 320x240, like you're experiencing.

Fostah
Hi Fostah, Thanx for the response.No, my application is not running in compatibility mode..Actually my Screen is having three componentsone HorizontalManager containing an EditField and a button , Then i added a MapField and then again a HorizontalManagers containg two buttons. I am trying to Fit the MapField between these two Horizontal Managers but it is getting displayed in much smaller size..
tek3
+1  A: 

The problem is that on a Storm, Display.getWidth() and getHeight() don't return the same thing all the time-- they attempt to account for the presence (or not) of the soft keyboard. The point at which the system decides the keyboard is there or not is pretty irrational. (The Storm absolutely sucks, as I guess you've figured out.)

One way that seems to work is subclass sublayout(width, height) in your Screen. This will get called multiple times on the Storm, as the system flops its way around figuring out what's going on. So it means more calculation, but it works. The last values you see through there will be right.

Here's a rough template. Remember this is in your class that extends the Screen. (e.g. MainScreen)

protected void sublayout(int width, int height) {
    super.sublayout(width, height);
    // the screen is acutally width X height
    // do your screen-specific stuff here
}
cjp