Buttons in setTabList do no accept focus [message #1297466] |
Tue, 15 April 2014 17:52 |
Pete DeLine Messages: 6 Registered: April 2014 |
Junior Member |
|
|
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();
}
}
[Updated on: Tue, 15 April 2014 17:52] Report message to a moderator
|
|
|
|
|
Re: Buttons in setTabList do no accept focus [message #1391674 is a reply to message #1302828] |
Tue, 01 July 2014 08:32 |
Tomas R. Messages: 7 Registered: July 2009 |
Junior Member |
|
|
On the Mac, default setting is that user can use Tab to move keyboard focus between text boxes and lists only. It is system-wide setting and SWT honors it.
To use Tab to move focus between all controls see System Preferences > Keyboard > Keyboard Shortcuts and for Full Keyboard Access select the 'All controls' option.
Alternatively there is a default key-binding for switching this setting: Control+F7.
Your snippet works
[Updated on: Tue, 01 July 2014 08:35] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02972 seconds