检查j2me中的CustomItem是否支持遍历
检查j2me中的CustomItem是否支持遍历?
我应该如何检查j2me中的CustomItem是否支持遍历?
Checking the CustomItem in j2me support traversal or not?
How should I check the CustomItem in j2me support traversal or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Shiva,我认为你对穿越的理解存在一些差距。让我解释一下。
您可以向表单添加任意数量的项目。 该框架管理 MIDP 中内置的所有项目的以下
但是,当您扩展 CustomItem 并实现您自己的项目时,完全控制权就在实现中。考虑这样一种情况:表单包含 TextField 和 CustomItemImpl,并且您希望在 TextField 和 CustomItemImpl 之间切换。由于按键处理、命令处理和渲染全部由 CustomItemImpl 控制,因此框架必须通过某种方式知道您何时希望 TextField 拥有控制权以及何时需要将控制权传递给 CustomItemImpl。
这里是 CustomItem 中的 traverse() 方法介入的地方。当您完成 CustomItemImpl 中的渲染和捕获数据时,您返回 false;当您想要保留 CustomItemImpl 中的控件时,您返回 true。
让我进一步阐述。假设您正在实现一个 TreeItem。当焦点位于 TreeItem 上时,您需要执行以下操作:
所有上述功能构成 TreeItem 实现的一部分。但是,当您将 KEY_UP 移动到树的第一个节点或 KEY_DOWN 移动到树的最后一个节点时,您希望移动到 TextField / 与此 TreeItem 相邻的任何其他项目。让框架知道您的意图的方式是,
希望这能澄清您的疑问。我强烈建议您查看这个特定的示例更具体的说明。
Shiva, I think there is some gap in your understanding of what traversal is about. Let me explain.
You can add any number of Item (s) to Form. The framework manages the following for all Item(s) built-in into MIDP
But when you extend CustomItem and implement your own item, complete control lies within the implementation. Consider a case where a Form contains a TextField and CustomItemImpl and you would want to toggle between TextField and CustomItemImpl. Since key handling, command handling and rendering is all in the control of CustomItemImpl, there must be a way in which framework must know when you want the TextField to have control and when the control needs to be passed on to CustomItemImpl.
Here is where traverse() method in CustomItem steps in. You return false when you are done with rendering and capturing data in CustomItemImpl and return true when you want to retain the control within the CustomItemImpl.
Let me elaborate further. Suppose you are implementing a TreeItem. When the focus is on TreeItem, you would like to do the following:
All the above functionality forms part of your TreeItem implementation. However when you move KEY_UP past the fist node of the tree or KEY_DOWN past the last node of the tree, you would like to move over to TextField / any other item adjacent to this TreeItem. The way in which you let the framework know your intention is
Hope this clarifies your query. I would strongly suggest you to have a look at this particular example for more concrete illustration.
我找到了解决方案。它对我有用。
正确的解决方案查找CustomItem遍历是由设备调用类“javax.microedition.lcdui.CustomItem”的方法“getInteractionModes()”支持的。
下面给出了代码片段
,在上面的代码片段中,“this”指的是从“javax.microedition.lcdui.CustomItem”派生的类的对象
I find the solution. It's working for me.
The correct solution Finding the CustomItem traversal is supported by the device calling the method "getInteractionModes()" of the class "javax.microedition.lcdui.CustomItem".
Code snippet is given below
in the above code snippet the "this" refers to the object of the class which is derived from "javax.microedition.lcdui.CustomItem"