GtkCombo
Text entry field with a dropdown list.
Object Hierarchy
Direct subclasses
None.
Description
A GtkCombo appears to be the equivalent of the
select element in HTML. This can be misleading if
you're coming directly from a web development background; a GUI widget
is largely about appearance, and carrying hidden values is not something
this one will do without a little programming. Luckily, there are a trio
of invaluable GtkObject methods that will do just
that, with any object and with any form of data. These are
get_data() ,
set_data() and
remove_data() . See the sample
under GtkCombo's
constructor to get an
idea of their usage.
There are a few key bindings in the combo widget. Most of them have
some bearing on searches.
Table 1. Key bindings in GtkCombo
Key combination | Function |
---|
Return (from the entry box) |
Opens up the list. If the entry contains text that fully matches
a list item's content, that list item will be selected on opening.
|
Tab + MOD_1 mask (from the entry box) |
The MOD_1 modifier is usually Alt. This key
combination auto-completes a partial entry.
|
Arrow up (from the entry box) |
If use_arrows has been set to
true, scrolls up through the list without opening
the list window. Can also be achieved with keypad arrow or
Alt + p.
|
Arrow down (from the entry box) |
If use_arrows has been set to
true, scrolls down through the list without
opening the list window. Can also be achieved with keypad arrow
or Alt + n.
|
Return (from the list box) |
Toggles the list item that has current focus.
|
Spacebar (from the list box) |
Selects the list item that has current focus.
|
Up arrow (from the list box) |
Scrolls up through the list items.
|
Down arrow (from the list box) |
Scrolls down through the list items.
|
Esc (from the list box) |
Removes grab from the list box, which closes it.
|
The normal but annoying behaviour is that the first entry is selected
when you open the dropdown. This can be stopped by doing the following:
$objList = $objCombobox->list;
$objList->set_selection_mode( GTK_SELECTION_SINGLE);
|
See also: GtkEditable,
GtkEntry, GtkItem,
GtkList, GtkListItem,
GtkOptionMenu.
GtkCombo has been deprecated since GTK+ 2.0 and should
not be used in newly written code.
Constructor
--
Creates an entry box with a dropdown list.
Properties
entry:
Text entry field.
list:
Dropdown list.