Itcl Tabgroup Widget

Tab group widgets provide functionality similar to Motif tab groups. A Tab group is a frame widget which supports keyboard navigation between its child widgets and between other tab-groups in the same top-level window. They work best when used with focus highlighting.

Synopsis

tabgroup pathName ?options?
create a new tab group widget named pathName.
pathName option ?args...?
manipulate the tab group widget named pathName.

Options

Tab-groups support the same configuration options as frame widgets

Widget Command

pathName configure option value ?option value ...?
Configure the widget by changing one or more of its public variables.

pathName manage ?option...? widget ?widget...?
Manage the keyboard navigation for the given widgets. By default, the following keyboard functions are bound to the widgets:
<Right>, <Down>
Move the focus to the next widget in the current tab-group
<Left>, <Up>
Move the focus to the previous widget in the current tab-group
<Tab>, <Control-Tab>
Move the focus to the next tab-group of the current top-level window.
<Shift-Tab>, <Control-Shift-Tab>
Move the focus to the previous tab-group of the current top-level window.

The option parameters can alter the functions bound to the widgets so as to avoid clashes with any normal bindings the widgets have. Any number of the following options can be specified:

-notab
No bindings are created for <Tab> and <Shift-Tab>. However, bindings are still created for <Control-Tab> and <Control-Shift-Tab>.
-nohorizontal
No bindings are created for <Left> or <Right>. For instance, this option would be specified when managing an entry widget.
-novertical
No bindings are created for <Up> or <Down>. For instance, this option would be specified when managing an listbox widget.
Note: If a widget is managed using both the -novertical and -nohorizontal options (a text widget, for example), it should be placed in on it's own in a separate tab group so that keyboard navigation can be performed using the <Control-Tab> and <Control-Shift-Tab> bindings.

pathName unmanage widget ?widget...?
Stop managing keyboard navigation for the given widgets.

When To Use Tab Groups and When To Use Frames

Currently, it is an error for a tab group to have no managed widgets. Therefore, if you want to group a number of output-only widgets (label or message widgets for instance, then you should use a frame widget. If you want to group a number of widgets which include one or more input widgets, then use a tabgroup widget.

Focus Handling

Tab group widgets automate the handling of the focus widget. When receiving the focus, tab group widgets pass the focus to its first managed widget. The tab group module also adds bindings to top level widgets so that when they receive the focus, they pass it to their first tab group.

Note however that if you create a top level window with a class name other than TopLevel, the bindings to focus on the widget's first tab group will no longer operate. You will have to bind that functionality yourself with the code:

bind widget <FocusIn> {
   focus [tabgroup :: first_tabgroup %W]
}

Bugs

Keyboard traversal does not work properly with listbox widgets, since they have no way of setting the keyboard focus to individual list items. This problem will be fixed by implementing an Itcl listbox class; however this hasn't been done yet.


Nat Pryce (np2@doc.ic.ac.uk)