kombobox widget
The kombobox was developed out of frustration with the standard Tix combobox.
This version may still have bugs and missing features as I have only worked
seriously on those parts needed for the
file select window.
Usage:
kombobox widget-path ?options?
Options
- -expand boolean
- If boolean is yes, true or on the combobox
widget can be expanded when it is finally packed, otherwise the widget
has a fixed width. Defaults to ``true''.
- -editable boolean
- If boolean is yes, true or on the combobox's
displayed value can be edited, otherwise it is read-only and can only
be changed by using the drop-down choice box. Defaults to read-only.
This option may be abbreviated to -edit.
- -height items
- sets the number of items displayed in the drop-down choice box. If there
are more than items in the choice list, a scroll bar is provided.
Default number of items is 10.
- -justify left|center|right
- sets the justify mode for the value displayed by the combobox.
Defaults to centre.
- -showvalue text
- defines the value to be displayed by the combobox. This option
may be abbreviated to -value.
- -list list
- initialises the choicebox list. Whenever <Return> is pressed
in the editable combobox, the new value is appended to the list. The
kombobox's choice-list may be read at any time using the ``cget -list''
widget command.
- -command script
- script is executed whenever a value is chosen from the
drop-down choice box, or <Return> is pressed in the editable text window.
Widget Commands
In addition to the standard ``cget'' and ``configure'' commands,
the kombobox widget provides the following specialised commands;
- post
- arranges to display the choicebox as if the user had clicked the
right-hand button.
- unpost
- closes the choicebox.
- selectionindex
-
Returns the list index of the last selected item from the choice box.
Returns -1 if no selection index is available.
To find the value currently displayed by the comboxbox, use the cget
widget command and read the value of showvalue.
Special Considerations
There is currently no way to disable a kombobox.
There is currently no way to set the width of a kombobox which means,
effectively, you have to use it with the -expand true option.
Ktk is maintained by
Andrew F. Lack
This page was last updated on 16th February 1999