I'm creating an application where I attempt to duplicate the UI layout of the built-in MemoPad app: a listfield and, in the status, a search bar. Both of them must appear to have the focus, and both of them must behave as though they have the focus, but the search bar handless keypress events while the listfield handles scroll and click events.
Unfortunately, I seem to have run into a paradox where if either one doesn't actually
have focus, it cannot be made to behave correctly:
- If the search bar (an AutoTextEditField) does not have focus, it does not composite text correctly on the BlackBerry Pearl. I tried forwarding keyChar events to it, but at this point the text is already composited (incorrectly) by the focused field.
- If the ListField does not have focus, I can make it behave 99% correctly by sending moveFocus events from the AutoTextEditField there; but scroll arrows are never painted by its manager. The manager only draws scroll arrows if its contents have focus, it seems. I could override this behavior with a custom manager, but I don't really control it because I'm using a MainScreen. And no, I don't want to switch to a FullScreen, because the Mainscreen provides a HUGE amount of useful functionality that I'm already using - I would basically have to rewrite the MainScreen class from scratch.
Snippets of code follow, to give you an idea of what I'm doing. Any ideas for how to force the MainScreen's manager to show scroll arrows, or for how to force a non-focused AutoTextEditField to composite text correctly on the Pearl?
// This is the constructor for the Screen that descends from MainScreen.
// Create the big list control.
customList = new CustomListField();
// Add the big list control and its search bar to the screen.
// This is the constructor for the custom list that descends from ObjectListField.
final CustomListField list = this;
// Search bar must be FOCUSABLE to do input autocompletion for the Pearl.
this.searchBar = new AutoTextEditField("Search: ", "", 20, Field.EDITABLE | TextField.NO_NEWLINE)
// Send all scroll events to the list.
protected int moveFocus(int amount, int status, int time)
list.moveFocus(amount, status, time);