09-08-2008 01:10 PM
I am taking the plunge and converting my Custom MIDP widgets to Custom Blackberry Field.
I am using the Vertical Field manager and add the first Custom Field which is simple an image banner
It will say its preferred height is 65. Then I add my main Widget which uses this layout() method below, it wants the fullscreen if
it can get it (and it should not since there is a banner added already).
public void layout(int w, int h)
height = Graphics.getScreenHeight();
width = Graphics.getScreenWidth();
and my getPrefs are
public int getPreferredWidth()
public int getPreferredHeight()
Now the layout(w,h) you would think the h is smaller then the screen since the first (65) item had been added but
a huge number 073741789
So what that tells me is that I don't know how this Manager works. I would think simple add items and then
will be vertically added. Do I have to track the additions?
I just want to add rows. By the way the first row (Field widget) will says its pref is 65 the middle row (Field widget) will say it wants it all and
the last row (field widget) will say its pref is 30. I would assume the VerticalManager will not work then?
09-08-2008 03:56 PM
It is possible you are mixing up Screen size (i.e. the logical size of the screen to be displayed) and Display size, which the size of the LCD on which the screen will be displayed. If Screen size exceeds Display size, then the User will only be seeing a small portion of the screen.
I think this is what you are seeing. A VerticalFieldManager will allow its display fields to overflow the Display size vertically for as long as is needed - the user will scroll to see some of the Fields. By contrast, you will find a HorizontalFieldManager will overflow the Display size in the Horizontal direction, so the User may have to scroll Horizontally to see all the Screen.
If you want to restrict the VerticalFieldManager to just the size of the Display, then I think you can by using NO_VERTICAL_SCROLL, i.e.
VerticalFieldManager vfm = new VerticalFieldManager(NO_VERTICAL_SCROLL);
I must be honest, I've never tried this, so perhaps this doesn't work, but it makes sense to me.
If you want a fixed bit at the top, a fixed bit at the bottom, and variable Fields between, I would suggest you look at extending MainScreen, and using setTitle(..) to set the top bit and setStatus(..) to set the bottom.
Hope this helps.