Wiki Markup |
---|
{alias:qcombobox}
h2. Name
*qcombobox* — collapsable text entry box
h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}
*qcombobox* \[_cmds_ ...]
{panel}
h2. 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].
h2. Arguments
_cmds_
{indent}
One or more commands that are executed when the user selects an item in the combo. The item itself is appended to the list of commands before execution. It is the programmers responsibility to ensure that the resulting command is a valid Tcl command.
{indent}
h2. Examples
h3. Ex.1: QComboBox
{anchor:QComboBox}
{noformat:|borderWidth=1|bgColor=#eeeeee} |
Name
qcombobox — collapsable text entry box
Syntax
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
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
Anchor | ||||
---|---|---|---|---|
|
No Format | ||||
---|---|---|---|---|
| ||||
# 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
{noformat}
!att:_img_cmd^qcombobox.png!
Example +QComboBox+ shows two QComboBoxes, one having attached the callback procedure |
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.
...