08-04-2008 05:39 PM
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?
08-07-2008 12:07 PM
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.