I'm adding in some functionality to a MIDP-based app which requires me to track whether or not an Item
has focus. I'm only really concerned with field-style Items and need to determine when the user has finished inputting data into the Item.
I'm aware that CustomItem has the traverse()
callback, but I can't find anything similar for classes like DateField
, TextField
and ChoiceGroup
.
I'm also aware of Display.setCurrentItem()
but for some strange reason there doesn't seem to be a Display.getCurrentItem()
method.
Implementing all the controls as CustomItems isn't really an option as it's a pre-existing app and there are quite a lot of controls to deal with. I can't believe that nobody has run into this issue before, but I've searched on here and google to no avail. Hopefully I'm just missing something obvious in the API, but if there isn't a definite answer then creative solutions are welcome!
In MIDP 2 lcdui API, the only field-style Items are, well, interactive subclasses of Item
: TextField, DateField, Gauge.
For above items the closest match to what you are asking about seem to be provided by ItemStateListener
(take a look at API javadocs here if you're interested).
...used by applications which need to receive events that indicate changes in the internal state of the interactive items...For implementations that have the concept of an input focus, the listener should be called no later than when the focus moves away from an item whose state has been changed.