Tab Order

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Tab Order

Postby TMehrens » Thu Sep 13, 2007 1:33 pm

I am trying to create a complex form that has over 150 widgets on it, (labels, lines, text, combo, and radio buttons). It is currently made up of a composite with six groups in it.
To get my tab key to work I used the setTabList on the composite and on each of the individual groups so once it tabbed through one group it would go on to the next group in a logical progression through the form.

My next challenge was to get the sets of radio buttons within each group to work independently. In order to do this I tried to add groups within my groups for each of the sets of radio buttons. This resolved the radio button problem but now the tab key bypasses the radio button sets within each group.

How can I get the tab key to work so rather than bypassing a group within a group it knows that it should tab into the radio button set?

Thanks in Advance,

Posts: 7
Joined: Thu Feb 22, 2007 1:01 pm
Location: Helena, MT

Re: Tab Order

Postby Eric Clayberg » Fri Sep 14, 2007 11:46 am

Without a test case, I'm not sure what the problem is or what the exact solution would be.

When I tried an example with nested groups, it worked fine...

Code: Select all
   protected void createContents() {
      shell = new Shell();
      final GridLayout gridLayout = new GridLayout();
      gridLayout.makeColumnsEqualWidth = true;
      gridLayout.numColumns = 2;
      shell.setSize(329, 222);
      shell.setText("SWT Application");

      final Text text = new Text(shell, SWT.BORDER);
      text.setData("name", "text");
      final GridData gd_text = new GridData(SWT.FILL, SWT.CENTER, true, false);

      final Text text_2 = new Text(shell, SWT.BORDER);
      text_2.setData("name", "text_2");
      final GridData gd_text_2 = new GridData(SWT.FILL, SWT.CENTER, true, false);

      final Group group = new Group(shell, SWT.NONE);
      group.setData("name", "group");
      final GridData gd_group = new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1);
      final GridLayout gridLayout_1 = new GridLayout();
      gridLayout_1.makeColumnsEqualWidth = true;
      gridLayout_1.numColumns = 2;

      text_3 = new Text(group, SWT.BORDER);
      text_3.setData("name", "text_3");
      final GridData gd_text_3 = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);

      group_1 = new Group(group, SWT.NONE);
      group_1.setData("name", "group_1");
      final GridData gd_group_1 = new GridData(SWT.FILL, SWT.CENTER, true, false);
      group_1.setLayout(new GridLayout());

      final Button button = new Button(group_1, SWT.RADIO);
      button.setData("name", "button");
      button.setText("Radio Button");

      final Button button_1 = new Button(group_1, SWT.RADIO);
      button_1.setData("name", "button_1");
      button_1.setText("Radio Button");

      group_2 = new Group(group, SWT.NONE);
      group_2.setData("name", "group_2");
      final GridData gd_group_2 = new GridData(SWT.FILL, SWT.CENTER, true, false);
      group_2.setLayout(new GridLayout());

      final Button button_2 = new Button(group_2, SWT.RADIO);
      button_2.setData("name", "button_2");
      button_2.setText("Radio Button");

      final Button button_3 = new Button(group_2, SWT.RADIO);
      button_3.setData("name", "button_3");
      button_3.setText("Radio Button");
      group.setTabList(new Control[] {group_2, text_3, group_1});

      final Text text_1 = new Text(shell, SWT.BORDER);
      text_1.setData("name", "text_1");
      final GridData gd_text_1 = new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1);
      shell.setTabList(new Control[] {text, text_2, group, text_1});
Eric Clayberg
Software Engineering Manager

Author: "Eclipse Plug-ins"
Eric Clayberg
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Return to SWT Designer

Who is online

Users browsing this forum: No registered users and 2 guests