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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
New Contributor
Posts: 6
Registered: ‎04-10-2014
My Device: BlackBerry OS 7.0 , model 9900
My Carrier: mobile
Accepted Solution

Where is the control events of the track pad for blackberry.

There is  an application for blackberry. It need move the PAGE at the between of the screen right or left by touch the track pad.

Now, it  moves to right and left . BUT some times two PAGEs (half and half) will remain one screen.

How can I control one Page to one screen by track pad. Or how can I restrict moving for this page by track pad.

 

Could you provide the control events for track pad?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Where is the control events of the track pad for blackberry.

You haven't given us much toi go on here, there are lots of different ways of doing what you are describing and the solution will be dependent on which way you have sone it.

 

So if the following doesn't help, please create a small test that we can run, that demonstrates the problem, and paste it in here.  Then we can try to run your code and see the problem and test the solutions.  So we need to be able to run your test code without any of your other classes. 

 

But can you tell us what are you using currently to detect the trackpad swipes?

 

I presume you have some sort of HorizontalFieldManager and the scroll is only going 1/2 way which is why you are seeing two pages at the same time.  You can detect scroll movement and try to make sure it does not stop 1/2 way yourself using a scoll listener.  Alternatively, if you set focus on some Field, Managers will tyupically scroll to make sure that the entire Feild is displayed, so you can get the Manager to do the scrolling.

New Contributor
Posts: 6
Registered: ‎04-10-2014
My Device: BlackBerry OS 7.0 , model 9900
My Carrier: mobile

Re: Where is the control events of the track pad for blackberry.

I paste the  relevant code for touchevent. Please check it.

1. I used the TouchEvent, it can scrolling by touchscreen, but the trackpad can`t get the event.

2.Is this code wrong (Highlight red)? if yes,then what ways can we control the trackpad?

 

//#ifndef VER_4.6.1 | VER_4.6.0 | VER_4.5.0 | VER_4.2.1 | VER_4.2.0

    protected boolean touchEvent(TouchEvent message) {

        

     

     

        int eventCode = message.getEvent();                 

        int touchX =  message.getX(1);

        int touchY =  message.getY(1);

       

     if (touchX < 0 || touchY  < 0 || touchX > getExtent().width || touchY  > getExtent().height) {

           // Outside the field

        return false;

    }

        

     

     if (eventCode == TouchEvent.GESTURE) {

            TouchGesture gesture = message.getGesture();

               switch(gesture.getEvent()) 

               {

                 case TouchGesture.NAVIGATION_SWIPE:

                  Dialog.alert("Swipe direction: " + gesture.getSwipeDirection()  

                          +            ", "

                          +            "\nMagnitude: " + gesture.getSwipeMagnitude());

                   return false;

               }

     

     }

     

      

    if (eventCode == TouchEvent.GESTURE) {

           int direction = message.getGesture().getSwipeDirection();

               

           if (direction == TouchGesture.SWIPE_WEST)

           {

              System.out.println("TouchGesture.SWIPE_WEST............");

           }

           else if (direction == TouchGesture.SWIPE_EAST)

           {

              System.out.println("TouchGesture.SWIPE_EAST............");

           }

          

             

           return true;

       }

      

        

       if(eventCode == TouchEvent.DOWN) {    

         System.out.println("TouchGesture.DOWN............");

        }

       

            

        if(eventCode == TouchEvent.MOVE) {

          

           System.out.println("TouchGesture.MOVE............");

            

        } 

        

        if (eventCode == TouchEvent.CANCEL)

        {

           System.out.println("TouchGesture.CANCEL............");

        }

        

        if (eventCode == TouchEvent.UP)

        {

           System.out.println("TouchGesture.UP............");

        }

        return false;

    }

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Where is the control events of the track pad for blackberry.

I usually detect movement on the trackpad by overriding navigationMovement(...).  Have a look at that.

New Contributor
Posts: 6
Registered: ‎04-10-2014
My Device: BlackBerry OS 7.0 , model 9900
My Carrier: mobile

Re: Where is the control events of the track pad for blackberry.

Haaaaa,it resovled ,thank you very much.