Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 18
Registered: ‎03-10-2009
My Device: Not Specified

TouchGesture events not firing in emulator, how to get a Swipe to work?

[ Edited ]

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;                            

                        } 

                        isConsumed = true; // We've consumed the touch event.              

                    }

                }     

            }

            return isConsumed;       

        }

 

Message Edited by vvtechser on 07-23-2009 12:45 PM
Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: TouchGesture events not firing in emulator, how to get a Swipe to work?

The swipe is extremely difficult to simulate with a mouse, but it *does* work.

 

You have to swipe the mouse very quickly.

 

You can also change the sensitivity settings in the simulator device options.

 

Developer
Posts: 109
Registered: ‎02-09-2009
My Device: Not Specified

Re: TouchGesture events not firing in emulator, how to get a Swipe to work?

Agreed, they are unreliable but it is possible and you get used to it quickly.
Highlighted
Contributor
Posts: 12
Registered: ‎10-29-2010
My Device: Not Specified

Re: TouchGesture events not firing in emulator, how to get a Swipe to work?

Guys..still not able to get this working......neither on the actual TORCH ....using SK 6.0 .....any help ?