BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-16-2007, 02:53 AM   #1 (permalink)
New Member
 
Join Date: Jul 2007
Model: 7290
PIN: N/A
Carrier: blank
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question How can I implements the left-right function of a trackball?

Please Login to Remove!

Hi:
My application is a midp application. I using the javax.microedition.lcdui.Canvas. I need to know how can i implement the trackball fuctions(up, down, click, especially the left and right).

I tried the public boolean trackwheelRoll(int amount,int status,int time) but i can't get a message when i roll left or right of the trackball on the simulator.

Can anyone help me?


By the way, when i roll the trackball vertically or flatly, will the "status" return different value?
Thanks a lot~

Last edited by Asuna : 07-18-2007 at 02:32 AM.
Offline  
Old 07-18-2007, 09:27 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 8300
PIN: N/A
Carrier: AT&T
Posts: 25
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Asuna View Post
Hi:
My application is a midp application. I using the javax.microedition.lcdui.Canvas. I need to know how can i implement the trackball fuctions(up, down, click, especially the left and right).

I tried the public boolean trackwheelRoll(int amount,int status,int time) but i can't get a message when i roll left or right of the trackball on the simulator.

Can anyone help me?


By the way, when i roll the trackball vertically or flatly, will the "status" return different value?
Thanks a lot~

I have used the method
navigationMovement(int dx,int dy,int status, int time)
{
if ((status & KeypadListener.STATUS_TRACKWHEEL) ==
KeypadListener.STATUS_TRACKWHEEL)
etc ....

and you test the dx ( positive = right negative= left movement)

I hope this can help.

Thanks
Offline  
Old 07-19-2007, 05:33 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

in my class i overrides the navigationMovement() method of the Manager class to catch the right click of the trackwheel event...well it is not working...here is my code:

protected boolean navigationMovement(int dx, int dy, int status, int time) {
if ((status & KeypadListener.STATUS_TRACKWHEEL) == KeypadListener.STATUS_TRACKWHEEL) {
if (dx > 0) {
Dialog.alert("right");
}
}
return true;
}

Is it ok?
Offline  
Old 07-24-2007, 10:50 AM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Jul 2007
Model: 8300
PIN: N/A
Carrier: AT&T
Posts: 25
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I remember well I have commented out the first test (i.e)

//if ((status & KeypadListener.STATUS_TRACKWHEEL) ==
//KeypadListener.STATUS_TRACKWHEEL)
if(dx > 0)

I directly test for dx value . But you have to be carefull on what event you are interested in. The track ball moves up, down, left and right but also diagonal where you get both dx and dy values. If you are interested in any left or right movement ( which was my case) you just play with dx values and it should work fine.

I hope this will help.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.