黑莓风暴模拟器

编程入门 行业动态 更新时间:2024-10-21 17:47:02
黑莓风暴模拟器 - TouchGesture事件没有开火,如何让刷卡工作?(Blackberry Storm Emulator - TouchGesture events not firing, how to get a Swipe to work?)

一直在玩Storm Emulator和4.7 JDE,对于我的生活,我无法弄清楚如何在模拟器中触发手势事件。

以下是RIM示例应用程序EmbeddedMapDemo的触摸事件代码。 它似乎很简单,但touchGesture.getEvent()== TouchGesture.SWIPE似乎永远不会注册为true。

如何在模拟器中注册滑动? 用我的鼠标我尝试左键单击并拖动,但这似乎不起作用。

/** * @see Field#touchEvent(TouchEvent) */ protected boolean touchEvent(TouchEvent message) { boolean isConsumed = false; if(_mapField.isClicked()) { TouchGesture touchGesture = message.getGesture(); if (touchGesture != null) { // If the user has performed a swipe gesture we will // move the map accordingly. if (touchGesture.getEvent() == TouchGesture.SWIPE) { // Retrieve the swipe magnitude so we know how // far to move the map. int magnitude = touchGesture.getSwipeMagnitude(); // Move the map in the direction of the swipe. switch(touchGesture.getSwipeDirection()) { case TouchGesture.SWIPE_NORTH: _mapField.move(0, - magnitude); break; case TouchGesture.SWIPE_SOUTH: _mapField.move(0, magnitude); break; case TouchGesture.SWIPE_EAST: _mapField.move(- magnitude, 0); break; case TouchGesture.SWIPE_WEST: _mapField.move(magnitude, 0); break; } // We've consumed the touch event. isConsumed = true; } } } return isConsumed; }

Been playing with the Storm Emulator and the 4.7 JDE, for the life of me I can't figure out how to fire gesture events in the emulator.

Below is the touch event code for the RIM sample app EmbeddedMapDemo. It seems straightforward enough, but touchGesture.getEvent() == TouchGesture.SWIPE never seems to register to true.

How can I register swipes in the Emulator? With my mouse I try doing left-click and drag but that does not seem to work.

/** * @see Field#touchEvent(TouchEvent) */ protected boolean touchEvent(TouchEvent message) { boolean isConsumed = false; if(_mapField.isClicked()) { TouchGesture touchGesture = message.getGesture(); if (touchGesture != null) { // If the user has performed a swipe gesture we will // move the map accordingly. if (touchGesture.getEvent() == TouchGesture.SWIPE) { // Retrieve the swipe magnitude so we know how // far to move the map. int magnitude = touchGesture.getSwipeMagnitude(); // Move the map in the direction of the swipe. switch(touchGesture.getSwipeDirection()) { case TouchGesture.SWIPE_NORTH: _mapField.move(0, - magnitude); break; case TouchGesture.SWIPE_SOUTH: _mapField.move(0, magnitude); break; case TouchGesture.SWIPE_EAST: _mapField.move(- magnitude, 0); break; case TouchGesture.SWIPE_WEST: _mapField.move(magnitude, 0); break; } // We've consumed the touch event. isConsumed = true; } } } return isConsumed; }

最满意答案

按下鼠标左键模拟单击屏幕...模拟器(我认为也是一个真正的Storm设备)在你点击屏幕时不会触发TouchGesture事件。

你想要做的是按住鼠标右键并拖动,因为鼠标右键模拟屏幕点击,没有点击。 这样,您应该能够触发TouchGestures。

在模拟器上做手势有点困难,你必须快速移动,但如果使用鼠标右键,你应该能够做到。

Pressing the left mouse button simulates clicking down the screen... the simulator (and also an actual Storm device, I think) won't fire TouchGesture events while you're clicking down on the screen.

What you want to do is hold down the right mouse button and drag, since the right mouse button simulates a screen tap, without click. This way, you should be able to get TouchGestures to fire.

It's a little hard to do a gesture on the simulator, you kinda have to move fast, but if you use the right mouse button you should be able to do it.

更多推荐

本文发布于:2023-08-06 18:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1452838.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模拟器   风暴   黑莓

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!