Name
qcombobox — collapsable text entry box
Syntax
qcombobox [cmds ...]
Description
The qcombobox command creates a QComboBox object. This is a vertical list of items collapsed to a single item visible in an entry field. The entry field may be read-only. The user may expand the list by clicking on the expand-arrow at the combo's right. The user may assign one or more callback commands that are executed when a selection is made.
To add items to the combo, use the qinsertitem command. To set the contents of the text field directly use qsetitemtext.
Arguments
cmds
Examples
Ex.1: QComboBox
# Callback for combo. # The argument v is added by QTcl proc show_value { v } { qinformation "Combo value " $v } set w [qwidget] qsetwindowtitle QComboBox qvboxlayout { # Combo 1 qcombobox qadditem Red qadditem Green qadditem Blue # Combo with callback qcombobox show_value qadditems { Top Center Bottom } } qshow $w
Example QComboBox shows two QComboBoxes, one having attached the callback procedure 'show_value'. The values 'Top', 'Center', or 'Bottom' will be appended to the callback string, thus forming a call to 'show_value' with an argument. The resulting command will display the chosen value in a message box.