MIDP:获取或跟踪当前聚焦的项目

发布于 2024-12-17 02:04:57 字数 491 浏览 6 评论 0原文

我正在向基于 MIDP 的应用程序添加一些功能,这需要我跟踪 Item 是否具有焦点。我只真正关心字段样式的项目,并且需要确定用户何时完成向项目中输入数据。

我知道 CustomItem 有 traverse() 回调,但我找不到类似 DateFieldTextField 和 <代码>选择组。

我也知道 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

这样的小城市 2024-12-24 02:04:57

MIDP 2 lcdui API,唯一的字段样式项目Item的交互式子类:TextField、DateField、Gauge。

对于上述项目,与您所询问的内容最接近的匹配似乎是由 ItemStateListener 提供的(请查看 API javadocs 此处(如果您有兴趣)。

...由需要接收指示交互项内部状态变化的事件的应用程序使用...对于具有输入焦点概念的实现,应不晚于焦点出现时调用侦听器远离状态已更改的项目。

  • 如果您打算使用此 API,请仔细检查文档以验证它是否确实为您提供了您想要的东西 - 其中存在一些微妙的限制。如果事实证明您需要比这更大的控制,您的选择是使用低级 UI(Canvas、事件)或第 3 方库,如 LWUIT、J2ME Polish...

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.

  • If you plan to use this API, carefully check the docs to verify that it indeed gives you what you want - there are some subtle limitations there. If it turns out that you need greater control than that, your options are either to use low level UI (Canvas, events) or 3rd party library like LWUIT, J2ME Polish...
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文