The combo widget
In Brief
This widget provides a platform native way for users to select one option from a list.
On Mac: a menubutton with attached menu is used; on Windows and X11, a read-only entry field combobox.
Commands
::tclmacbag::combo pathName ?Options?
Available options:
- -textvariable variableName
The name of the variable linked to the widget. When the selection is changed, the variable's value changes.
- -values List
A list of entries to be selected from.
- -postcommand Command
A command to be run whenever a value is selected by the user using the widget.
- -state State
Available values: enabled or disabled.
- -background Color
The option exists from v0.18 onwards and colors the background between the edge of the button and the edge of the widget.
This option is ignored on platforms other than Aqua.
Required options: -textvariable, -values.
::tclmacbag::combo_Set pathName ?Options?
Available options:
- -textvariable variableName
- -values List
- -postcommand Command
- -state State
- -background Color
Example
grid [::tclmacbag::combo .c -textvariable animals -values {Cat Dog}] -row 1 -column 2
Further Info
This was one of the first widgets written, well before I planned TclMacBag as a package. It exists because Mac users expressed
outright horror at a combobox appearing in Mac applications, both in concept and in its Tile 0.7.8 implimentation.
The following options for the respective Tile widgets aren't (currently) supported by this metawidget: -height, -width, -exportselection, and -justify.
By default, this widget takes the background color of the Tile theme (on Windows and X11) or Pinstripe (on Mac).
The Mac variation of the widget has a width sized to that of the value with the most characters.
Do not attempt to change settings in this widget by using $w configure.
As is standard, ::tclmacbag::combo returns with value of pathName, for ease of use with geometry managers like grid and pack.