DOKK / manpages / debian 11 / tk-fsdialog / matchbox.3tcl.en
matchbox(3tcl) Tk Themed Widget matchbox(3tcl)


matchbox - text field with popdown selection and completion lists

package require Tk 8.6.3

package require matchbox 1.0


The ttk::matchbox widget is an extension of the regular ttk::combobox widget. It can be used wherever a ttk::combobox is currently used, without any other changes to the code.

The difference between the ttk::matchbox widget and the ttk::combobox widget is in the interaction with the user. An empty ttk::matchbox looks just like a ttk::combobox. However, when there is any text in the ttk::matchbox, an icon appears on the right-hand side of the text field. The user can click this icon to erase the text.

If the -matchcommand option is specified, an additional drop-down list may be displayed showing possible completions for the entered string.

Whenever the user changes the value of the ttk::matchbox widget, the command specified via the -matchcommand option is invoked with one additional argument; the current value of the widget. The command is expected to return a list of possible completions. These will be presented to the user via the second drop-down list of the widget. If the command returns an empty list, the drop-down list will not be displayed.

Note: The match command is not invoked when the user selects an entry from the main drop-down list.

The ttk::matchbox has one additional key binding, Control-u, that also erases all text in the ttk::matchbox.

Copyright (c) 2017 Schelte Bron
1.0 doc