在 BlackBerry 上使用 MIDP Canvas keyPressed / keyCode 获取 Canvas.FIRE 以进行轨迹球点击
我有一个 MIDP 应用程序,想在 BlackBerry 设备上运行。它非常通用,一个问题是当我重写 Canvas keyPressed(int keyCode) 方法时,我没有捕获触控板单击事件。
通常您会使用 getGameAction(keyCode) == FIRE 来捕获 MIDP 设备上导航板按钮的中心,但在这种情况下没有运气。我对黑莓论坛进行了广泛的搜索,但找不到任何明确的解决方案。单击轨迹球按钮时是否会调用 keyPressed 方法?适当的密钥代码是什么?
我知道,如果我转向 BlackBerry SDK,我可以使用关键侦听器和触控板单击类型事件,但我想首先尝试找到一个纯 MIDP 并且不需要多个构建的解决方案。
I have a MIDP application that I would like to run on BlackBerry devices. It's quite generic, the one gotcha is that when I override the Canvas keyPressed(int keyCode) method, I'm not capturing the trackpad click events.
Normally you would use getGameAction(keyCode) == FIRE to capture the center of the navigation pad button on MIDP devices, but in this case no luck. I've done extensive searching of blackberry forums and I can't find any clear solution. Is they keyPressed method even called when the trackball button is clicked? What is the appropriate keyCode?
I know that if I move over the BlackBerry SDK I can use key listeners and trackpad clicked type events, but I would like to first attempt to find a solution that is pure MIDP and does not require multiple builds.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 RIM Canvas 类的 javadoc< /a> 轨迹球键码是 -8。这是 JDE 4.5 链接,但在 4.3、4.6 和 4.7 中是相同的。因此,您可以为黑莓手机添加一些条件行为来查找该代码。
According to the RIM javadoc for the Canvas class the trackball keycode is -8. That's a JDE 4.5 link, but it's the same in 4.3, 4.6 and 4.7. So you could put in some conditional behaviour for BlackBerry handsets that would look for that code.