MIDP:获取或跟踪当前聚焦的项目
我正在向基于 MIDP 的应用程序添加一些功能,这需要我跟踪 Item
是否具有焦点。我只真正关心字段样式的项目,并且需要确定用户何时完成向项目中输入数据。
我知道 CustomItem 有 traverse()
回调,但我找不到类似 DateField
、TextField
和 <代码>选择组。
我也知道 Display.setCurrentItem()
但由于某些奇怪的原因,似乎没有 Display.getCurrentItem()
方法。
将所有控件实现为 CustomItems 并不是真正的选择,因为它是一个预先存在的应用程序,并且有相当多的控件需要处理。我不敢相信以前没有人遇到过这个问题,但我在这里和谷歌上搜索过,但没有结果。希望我只是遗漏了 API 中一些明显的东西,但如果没有明确的答案,那么欢迎创造性的解决方案!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 MIDP 2 lcdui API,唯一的字段样式项目是
Item
的交互式子类:TextField、DateField、Gauge。对于上述项目,与您所询问的内容最接近的匹配似乎是由
ItemStateListener
提供的(请查看 API javadocs 此处(如果您有兴趣)。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).