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

Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Trackwheel clicks on Forms

I'm porting a J2ME midlet over to Blackberry, and I'm having trouble catching trackwheel clicks on Forms.  On canvases, the trackwheel click will trigger the keyPressed method and that will work out.  On a form, that doesn't seem to work - the default trackwheel click event is to show the menu.


I have tried putting a TrackwheelListener on the item class that I need to detect the click with.  This will detect the trackwheel events, so it seems to be the ideal solution.  However, the trackwheel will still perform the default behavior of showing the menu.   Returning true in the trackwheel methods does not stop the menu from appearing.


So to recap, I have a form.  The form has a few items inside.  I would like to detect when the trackwheel is clicked, and then take some action based on this event.  By default, pushing the trackwheel acts the same as the Blackberry menu button.


What is the proper way to detect a trackwheel being clicked on a Form?



Andrew Cowart | Metova
BlackBerry Development Advisor
Posts: 15,882
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Trackwheel clicks on Forms

You are seeing the expected behaviour.  It is not support to capture trackwheel clicks on a Form.  This can be accomplished by using a Canvas.


TrackwheelListener are designed to be used in BlackBerry CLDC applications, not MIDlets.  GUI classes specific to each application type should not be intermixed.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.