BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 02-04-2006, 05:15 PM   #1
kbottner
New Member
 
Join Date: Feb 2006
Model: 8700c
Posts: 5
Default J2ME MIDlet using TrackwheelListener

Please Login to Remove!

Any J2ME developers out there who can point me in the right direction on where I can register a TrackwheelListener when developing a J2ME MIDlet.

Thanks in advance,

Keith
Offline  
Old 02-04-2006, 09:26 PM   #2
jonberry
Thumbs Must Hurt
 
Join Date: Apr 2005
Model: 950
Carrier: T-Mobile
Posts: 185
Default

I'm not sure that mixing the MIDlet UI with the BlackBerry UI is such a good idea.

What are you trying to accomplish?

Jon
Offline  
Old 02-05-2006, 06:32 AM   #3
stefan
Knows Where the Search Button Is
 
stefan's Avatar
 
Join Date: Oct 2004
Model: Curve
Carrier: Vodafone
Posts: 26
Default

You cannot mix MIDlet and BlackBerry UI. What you can do is to listen for the events generated by the wheel scrolling up or down. Unfortunatelly the wheel click does not generate an event in MIDlet implementation.
Offline  
Old 02-05-2006, 08:24 AM   #4
kbottner
New Member
 
Join Date: Feb 2006
Model: 8700c
Posts: 5
Default Need the Trackwheel click

We are porting a game to the Blackberry series and we would of course like to use as much of the native method of navigation as possible. Since we need to create a MIDlet and use GameCanvas we would need access to the track wheel "push"/"click" event. It appears that TrackwheelListener would fit the bill, however, we have been unsuccessful finding a RIM J2ME extension that allows registering a listener for this particular event.

You are correct BTW, the scrolling of the track wheel does get convert into UP, DOWN, LEFT, RIGHT events but we seem to never receive the "click".

Anybody have any other ideas? Or is the general consensus that you cannot do it through a MIDlet but would have to do it through an UI/Application.

Keith
Offline  
Old 02-06-2006, 12:50 PM   #5
eradis
Talking BlackBerry Encyclopedia
 
Join Date: Sep 2004
Model: 8700r
Carrier: Rogers
Posts: 221
Default

You can directly add the TrackwheelListener to any class that implements TrackwheelListener interface.

The TrackwheelListener is in the net.rim.device.api.system package not the net.rim.device.api.ui package.
Offline  
Old 02-06-2006, 04:12 PM   #6
kbottner
New Member
 
Join Date: Feb 2006
Model: 8700c
Posts: 5
Default Where would you register the listener?

Thanks for correcting me on where the TrackwheelListener lives, but where would I register a class that implements the TrackwheelListener interface? The problem is not implementing the interface, the problem is that I cannot find a way to register the listener to receive the events.

Keith
Offline  
Old 02-06-2006, 05:05 PM   #7
eradis
Talking BlackBerry Encyclopedia
 
Join Date: Sep 2004
Model: 8700r
Carrier: Rogers
Posts: 221
Default

To add the TrackwheelListener use the following code (from within the class in the constructor implementing TrackwheelListener - probably Canvas or GameCanvas).

Code:
Application.getApplication.addTrackwheelListener(this)
You could also do it from outside of the class but you would be required to have an instance of the class to reference.

You could then perform mapping to your existing event handlers (that are pure MIDP).
Offline  
Old 02-06-2006, 05:28 PM   #8
kbottner
New Member
 
Join Date: Feb 2006
Model: 8700c
Posts: 5
Default

Works like a champ, thanks for sharing the info.

Keith
Offline  
Old 02-23-2006, 04:31 AM   #9
mtnlife@speakeasy.net
New Member
 
Join Date: Feb 2006
Model: 7100g
Posts: 3
Default A bit confused

I understood this thread until how to register the TrackwheelListener.

Application.getApplication.addTrackwheelListener(t his);

Where did the Application class come from? Was the application created as a UIApplication instead of a MIDlet? If so how was the display accessed to set up the GameCanvas. What bridged standard J2ME and the RIM stuff? I have some nice GameCanvas operations I would like to keep but need the trackwheel click event.
Offline  
Old 02-23-2006, 06:37 PM   #10
kbottner
New Member
 
Join Date: Feb 2006
Model: 8700c
Posts: 5
Default I had the same problem understanding.

Basically you just need to have one of your classes implement TrackwheelListener and potentially KeyListener as well, then call the static methods to register the track wheel listener as below:

Application.getApplication().addTrackwheelListener (this);
Application.getApplication().addKeyListener(this);

Once I did this I received all track wheel and key listening notifications. If you have any other issues let me know and I will see if I can help.

Keith
Offline  
Old 02-23-2006, 10:48 PM   #11
mtnlife@speakeasy.net
New Member
 
Join Date: Feb 2006
Model: 7100g
Posts: 3
Default Many Thanks!!!

I did a rookie move and was trying to do the registration with:

Application.getApplication.addTrackwheelListener(t his);

Once I did the correct call:

Application.getApplication().addTrackwheelListener (this);

In came the event.

You guys saved me a bunch of time and this should make handset porting much easier.
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


MEASUREMENT COMPUTING PCI-DDA08/16 8-channel, 16-bit Analog Output Board 48 D IO picture

MEASUREMENT COMPUTING PCI-DDA08/16 8-channel, 16-bit Analog Output Board 48 D IO

$349.99



Measurement Computing 197728B USB 1608HS-2A0 16-Channel Digital DAQ +2 Analog picture

Measurement Computing 197728B USB 1608HS-2A0 16-Channel Digital DAQ +2 Analog

$422.50



Onset Computer Analog/Temp/RH/Light Data Logger MX1104 Onset Computer MX1104 picture

Onset Computer Analog/Temp/RH/Light Data Logger MX1104 Onset Computer MX1104

$261.31



Computer Boards Measurement Computing PCM-DAS08 picture

Computer Boards Measurement Computing PCM-DAS08

$200.00



Measurements Computing PCI-DDA02/16 Analog Output and Digital I/O Card picture

Measurements Computing PCI-DDA02/16 Analog Output and Digital I/O Card

$699.99



Measurement Computing CIO-DAS08 Multifunction Analog and Digital I/O Board picture

Measurement Computing CIO-DAS08 Multifunction Analog and Digital I/O Board

$599.99







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