push button on the same composite of radio group is getting focus for arrow keys [message #1063079] |
Wed, 12 June 2013 07:48 |
Amaravathi Yagati Messages: 5 Registered: June 2013 |
Junior Member |
|
|
Push button with a group of radio buttons on the same composite getting focus for arrow keys which is supposed to be used for selecting an option from radio group.
can we prevent this for PUSH button from getting focused to arrow keys. Is there any way ??
Here is the sample code .
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class SWTButtons {
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell(display);
//radio
Button[] radioButtons = new Button[3];
radioButtons[0] = new Button(shell, SWT.RADIO);
radioButtons[0].setSelection(true);
radioButtons[0].setText("Choice 1");
radioButtons[0].setLocation(50,150);
radioButtons[0].pack();
radioButtons[1] = new Button(shell, SWT.RADIO);
radioButtons[1].setText("Choice 2");
radioButtons[1].setLocation(120,150);
radioButtons[1].pack();
radioButtons[2] = new Button(shell, SWT.RADIO);
radioButtons[2].setText("Choice 3");
radioButtons[2].setLocation(190,150);
radioButtons[2].pack();
//Text
Text textBox = new Text(shell, SWT.BORDER);
textBox.setText("Test");
textBox.setLocation(260, 150);
textBox.pack();
//push button
Button pushButton = new Button(shell, SWT.PUSH);
pushButton.setLocation(100, 250);
pushButton.setText("Get Value (push button)");
pushButton.pack();
shell.setSize(500,500);
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.01886 seconds