View Single Post
Old 07-25-2005, 07:55 PM   #1 (permalink)
Knows Where the Search Button Is
timinator's Avatar
Join Date: Jul 2005
Location: Washington
Model: 8300
Carrier: AT&T
Posts: 29
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default How to determine which button is clicked?

Please Login to Remove!

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:

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;

class SalutationScreen extends MainScreen
public SalutationScreen()
LabelField applicationTitle = new LabelField("Hello World Title");
ButtonField testButton = new ButtonField("Click Me", FOCUSABLE);
ButtonField orButton = new ButtonField("Or Me", FOCUSABLE);
public boolean onClose()
Dialog.alert("Bye World!");
return true;
// Invoked when the trackwheel is clicked.
public boolean trackwheelClick( int status, int time )
Dialog.alert("Button clicked. Status:" + status) ;
return true;

Along with the associated routine. How do I determine which button was clicked?

Thanks in advance for the help.

"There are 10 types of people in the world.
Those that understand binary and those that don't!" - The ART of S/W Development