Buttons in setTabList do no accept focus [message #1297348] |
Tue, 15 April 2014 12:02  |
Eclipse User |
|
|
|
I have a Shell displaying three Buttons. I've created a Control array containing each button and used it to call shell.setTabList. For some reason, none of the buttons will receive focus as I attempt to tab between them. I've tried adding a FocusListener and a KeyListener to each one but that didn't help. The code is below. Thanks in advance for any help.
package com.example.swt.widgets;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class TabExample {
public static void main( String[] args ) {
Display display = Display.getDefault();
Shell shell = new Shell( display );
shell.setLayout( new RowLayout() );
Button b1 = new Button( shell, SWT.PUSH );
b1.setText( "Button1" );
Button b2 = new Button( shell, SWT.PUSH );
b2.setText( "Button2" );
Button b3 = new Button( shell, SWT.PUSH );
b3.setText( "Button3" );
Control[] controls = new Control[] { b2, b1, b3 };
shell.setTabList( controls );
shell.pack();
shell.open();
while( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
}
}
display.dispose();
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.08097 seconds