The groupbox widget

In Brief

The groupbox is an unusual widget which, on the Mac, traces its origins to Apple's Human Interface Guide.


You would use this where you know you will have too many pages for a notebook widget.

The groupbox first appeared in TclMacBag v0.09.

For a menu-less "groupbox" which simply acts as a container, see the boxframe widget.


::tclmacbag::groupbox pathName ?Options?


set gb [::tclmacbag::groupbox .g]
$gb add [ttk::frame $gb.a1] -text "Cats"
$gb add [ttk::frame $gb.a2] -text "Monkeys"
$gb add [ttk::frame $gb.a3] -text "People"
pack $gb -expand yes -fill both -padx 10 -pady 5

Known Bugs

There was a bug in the v0.09 release which impacted people who recreated the widget with the same pathName where the toplevel was marked resizable Off. This was fixed in v0.10. See the Changelog for details.

Further Information

This version is based on the implimentation by Joe English, however, this one provides a menubutton and menu on Macs or a Tile combobox for other platforms, much like the TclMacBag Combo widget.

An opinion: This is a wonky looking widget that probably shouldn't appear in real programs. Its aim is to provide a notebook which can display many tabs without resorting to those horrid multi-line tabs Microsoft inflicted upon us with Windows 95. However, a more modern approach would be to use a listbox/treeview showing the options and change tab/frame contents according to which one is selected. (See Figure 6-25 of Gnome's Human Interface Guide for an example.)

Always control your toplevel's dimensions when using this widget (using either [wm geometry] and/or [wm minsize]) to ensure frame contents (including buttons) are visible.