3

StormEmulatorと4.7JDEで遊んでいると、私が生きている間、エミュレーターでジェスチャーイベントを発生させる方法がわかりません。

以下は、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;       
}
4

1 に答える 1

4

マウスの左ボタンを押すと、画面のクリックがシミュレートされます...シミュレーター(および実際のStormデバイスもあると思います)は、画面をクリックしている間はTouchGestureイベントを発生させません。

マウスの右ボタンはクリックせずに画面のタップをシミュレートするため、マウスの右ボタンを押したままドラッグします。このようにして、TouchGestures を起動できるはずです。

シミュレーターでジェスチャを行うのは少し難しく、すばやく移動する必要がありますが、マウスの右ボタンを使用すればできるはずです。

于 2009-07-23T20:44:07.023 に答える