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
Developer
monmomo04
Posts: 58
Registered: ‎05-06-2012
My Device: Blackberry torch 9850
My Carrier: Voila
Accepted Solution

blackberry trackpad events

I want to manage two types of motion using a trackpad which one will be generate when the user moves the trackpad and another one when the user moves the trackpad but this time if the alt key pressed in, as exemple you can consider a BlackBerry equipped a trackwhell which generates a horizontal movement but in the case where alt is pressed generates a vertical movement. My source code look like this but it's does not work : boolean isAlt= false; _screen= new Screen{ protected boolean navigationMovement(int dx, int dy,int status, int time){ if(dx>0){ if(isAlt){ Dialog.alert("that's work"); }else{ moveRight(); } if(dx<0){ if(isAlt){ Dialog.alert("that's work"); }else{ moveLeft(); } if(dy>0){ if(isAlt){ Dialog.alert("that's work"); }else{ moveBackward(); } if(dy<0){ if(isAlt){ Dialog.alert("that's work"); }else{ moveForward(); } } return true; } protected boolean keyDown(int keycode, int time){ switch(keycode){ case Keypad.KEY_ALT: isAlt=true; default: super.keyDown(keycode,time); } return true; } protected boolean keyUp(int keycode, int time){ switch(keycode){ case Keypad.KEY_ALT: isAlt=false; default: super.keyDown(keycode, time); } return true; } }; i've try this but both keyDown and key upMethod are not invoked. Thank for your support.
Please use plain text.
BlackBerry Development Advisor
PBernhardt
Posts: 743
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: blackberry trackpad events

I'm not 100% sure what you are doing since your code seems to have lost it's formatting (try pasting it in with the insert code button when you make a post), but are you registering an implementation of a KeyListener anywhere?

 

I believe you also need to make sure you are getting the key pressed via the Keypad.key() method.

Paul Bernhardt
Application Development Consultant
BlackBerry
@PBernhardt

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker
Please use plain text.
Developer
monmomo04
Posts: 58
Registered: ‎05-06-2012
My Device: Blackberry torch 9850
My Carrier: Voila

Re: blackberry trackpad events

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /> <meta name="ProgId" content="Word.Document" /> <meta name="Generator" content="Microsoft Word 12" /> <meta name="Originator" content="Microsoft Word 12" />

What I wanted to do it's to generate two types of events with the trackpad, you can take a BlackBerry equipped with

a track wheel as example, so that it generate a horizontal movement but with the Alt key press in it generate a vertical

movement.

In fact, I have solve my problem since a long time, but still, thank for your reply.

 

My source code look like this:

 

 

 

 

_myScreen = new FullScreen(){

 

                        boolean isAlt=false;

 

                        protected boolean trackwheelClick(int status, int time){

                              _myScreen.userClick();

                              return true;

                        }

                        protected boolean keyDown(int keycode, int time){

                                          //-The alt KeyCode is ­­­­­generate. The alt key is press in but it's have

                              // a different Keycode whether the alt function is disable or enable.

                              if(keycode== 16842752 || keycode== 16842753){

                                    _myScreen.isAlt= true;

                                    }

                        return super.keyDown(keycode, time);

                      }

                      protected boolean keyUp(int keycode, int time){

                        if(keycode== 16842752 || keycode== 16842753){

                              _myScreen.isAlt= false;

                        }

                        return super.keyUp(keycode, time);

                      }

                              protected boolean navigationMovement(int dx, int dy,int status, int time){

                                    if(dx>0){

                                          if(_glRenderer.isAlt){

                                          //-generate a key Alt press in event with the trakpad

                                          }else{

                                          //-generate a NO key Alt press in event with the trakpad

                                                }

                                          }

                                   

                                    if(dx<0){

                                          if(_glRenderer.isAlt){

                                                //-generate a key Alt press in event with the trakpad

                                          }else{

                                          //-generate a NO key Alt press in event with the trakpad

                                                }

                                          }

                                   

                                    if(dy>0){

                                          if(_glRenderer.isAlt){

                                                //-generate a key Alt press in event with the trakpad

 

                                          }else{

                                          //-generate a NO key Alt press in event with the trakpad                                   }

                                          }

                                   

                                    if(dy<0){

                                          if(_glRenderer.isAlt){

                                                //-generate a key Alt press in event with the trakpad

                                          }else{

                                          //-generate a NO key Alt press in event with the trakpad

 

                                          }

                                    }

                                    return true;

                        }

                  };

 

Moenro Jeanniton.

 

Please use plain text.