Copyright © 2008, 2009 Arndt Roger Schneider
Rtl_tabsets are well used inside of preferences. A Rtl_tabset is beneficial with less than nine tabs. Use a folder like control –to replace a tabset– for more than nine pages.
Example 5.1. Create Tabs and Rtl_tabset
# Create the tabset: rtl_tabset .tabset ... # Add tabs to the tabset: .tabset add alpha ... .tabset add beta ... .tabset add gamma ... .tabset add delta ..
The Rtl_tabset interface is fashioned after the Tk Menu interface. Each tab must be named in advance –the Rtl_tabset follows an explicit naming convention.
Example 5.2. Hiding a Tab
# Hide the tab: beta, # rearrange delta and gamma: .tabset configure -show {alpha delta gamma}
Example 5.3. Rtl_tabset as a Window Manager
# Insert a tab resembling a window: .tabset add mywindow \ -foreground red \ -background white \ -text "My Child Window" -state normal; # Create the window after the tab, # similar to the Tk Menu interface. frame .tabset.mywindow # Force a visual refresh: .tabset redraw
The Example 5.3, “Rtl_tabset as a Window Manager” shows how to use the Rtl_tabset as a window manager. Again an explicit naming convention is being used.
A large dialog distributed over multiple pages. The dialog is the single only element inside a floating window (toplevel in Tcl/Tk). Possibly, additional dialog buttons –such as »OK« or »Cancel«– are present in the floating window.
The tabs of the tabset are located at the border of the floating window.
The tabset becomes identical with the entire dialog in this design. Hence the tabset should have no border of its own. Tabset borders would only increase the visual complexity of the dialog. There is no information whatsoever communicated through such borders or an alternate background colour for the tabset. Also, the dialog would have to be increased by the border size.
There is a multi pages element embedded in an dialog. The dialog contains other significant controls outside of the multi pages element.
The tabset, used in this design, needs borders and preferable an alternate background colour to bind its internal controls together.
The controls on the embedded pages have to adhere to the dialog’s layout. If the dimensions of an internal controls requires to modify the layout, then the layout change must be propagated throughout the enclosing dialog. The same applies to the size of the entire multi-page element. The grid geometry manager can be used to faciliate this design.
Example 5.4. grid remove
grid [label .l1 -text Label1:] \ -column 1 -row 2 -sticky e; grid [button .b1 -text b1] \ -column 2 -row 2 -sticky w; grid [label .l2 -text Label2:] \ -column 1 -row 2 -sticky e; grid [button .b2 -text \ "A very much longer button text"] \ -column 2 -row 2 -sticky w; # Unmap all embedded elements grid remove .l1 .b1 .l2 .b2 ... # l1 and b1 are the elements on page 1. # l2 and b2 are the elements on page 2.
# Display page 1. # Unmap all embedded elements grid remove .l1 .b1 .l2 .b2; grid .l1 .b1;
# Display page 2. # Unmap all embedded elements grid remove .l1 .b1 .l2 .b2; grid .l2 .b2;
Propagation from embedded pages can be channeled through the grid geometry manager. The controls on the different pages are managed by the outer dialog–they share the same parent window with the tabset-control. All the controls from all pages must be initial managed, then unmapped (hidden) from the dialog. »grid remove« performs this, but keeps the geometric informations. Example 5.4, “grid remove” shows how-to accomplish this with the grid geometry manager.
Although the Rtl_tabset supports this usage scenario. The resulting design is necessarily strange. The tabs of a tabset differ sharply from the other controls outside the multi-pages element, and thus create a significant distraction.
The AQUA® tabset design is the best choice for an embedded multi-pages element. It is possible to customize the tabs of a Rtl_tabset to resemble the AQUA® design. Using a radiobutton-group is however a superior solution. Use a gstripes radiobutton-group under every major windowing systems to do this. The radiobutton-group design is platform independent.