Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Buttons in setTabList do no accept focus(Buttons in setTabList do no accept focus)
Buttons in setTabList do no accept focus [message #1297348] Tue, 15 April 2014 16:02 Go to next message
Pete DeLine is currently offline Pete DeLineFriend
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();
  }
}
Re: Buttons in setTabList do no accept focus [message #1297459 is a reply to message #1297348] Tue, 15 April 2014 17:47 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
You might get more response by asking on the SWT forum; it's not necessarily a "Newcomers" type of questions, since most Eclipse users don't write SWT code.
Previous Topic:Creating watchpoints for global variables
Next Topic:Eclipse Indigo Update Errors
Goto Forum:
  


Current Time: Tue Apr 16 07:18:00 GMT 2024

Powered by FUDForum. Page generated in 0.08878 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top