How to determine which button is clicked?
I'm a rookie at the BB stuff but an experienced developer. In looking at the samples and doing searches via Google, I've yet to come across an example of how to determine which of two buttons have been clicked with the trackwheel. I currently have the following code, modified from the Hello World sample:
class SalutationScreen extends MainScreen
LabelField applicationTitle = new LabelField("Hello World Title");
ButtonField testButton = new ButtonField("Click Me", FOCUSABLE);
ButtonField orButton = new ButtonField("Or Me", FOCUSABLE);
public boolean onClose()
// Invoked when the trackwheel is clicked.
public boolean trackwheelClick( int status, int time )
Dialog.alert("Button clicked. Status:" + status) ;
Along with the associated HelloWorld.java routine. How do I determine which button was clicked?
Thanks in advance for the help.
use a field change listener.
Duh! How about an example? Or at least point me to a sample that demonstrates how this works with multiple buttons.
Well, I finally figured this out. I'm surprised that something that should be so easy to do was so difficult to figure out. I guess it's due to the fact that I'm a C & C# developer, just now getting into java. Plus, the fact that the BB does things a little differently. Anyway, for the benefit of anyone else trying to figure this out, here's my sample code for determing which button is being selected. Enjoy.
|All times are GMT -5. The time now is 02:13 PM.|
Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.