This article applies to BlackBerry® wireless devices based on Java™.
A manager created with the Manager.HORIZONTAL_SCROLL or Manager.VERTICAL_SCROLL style enables scrolling if focusable fields are located outside of the visible portion of the manager. This can cause an issue for managers that do not contain any focusable fields; however, it does not mean that such managers are not scrollable.
To enable scrolling on a manager with non-focusable fields, use the NullField class. By adding focusable NullFields throughout the manager, you can allow the user to scroll through it.
Note: A NullField is not visible to the user.
Here is an example of a NullField:
MainScreen mainScreen = new MainScreen();
//Create a scrollable VerticalFieldManager.
VerticalFieldManager vfm = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL);
//Add a focusable NullField to the top of the screen to allow the user to scroll to the top.
//Add 10 fields. They will not quite fit on the screen of a BlackBerry 7200 Series of Wireless Handheld™.
//Comparing to 0 and decrementing is faster on a BlackBerry wireless device than incrementing and comparing
//to a non zero value.
for (int count = 10; count >= 0; --count)
vfm.add(new LabelField("Field number " + count, LabelField.NON_FOCUSABLE));
//Add a focusable NullField to the bottom of the screen to allow the user to scroll to the bottom.