Gtk.ComboBox
const Gtk = imports.gi.Gtk; let combo_box = new Gtk.ComboBox({ active: value, active_id: value, add_tearoffs: value, button_sensitivity: value, cell_area: value, column_span_column: value, entry_text_column: value, focus_on_click: value, has_entry: value, has_frame: value, id_column: value, model: value, popup_fixed_width: value, row_span_column: value, tearoff_title: value, wrap_width: value, });
A GtkComboBox is a widget that allows the user to choose from a list of valid choices. The GtkComboBox displays the selected choice. When activated, the GtkComboBox displays a popup which allows the user to make a new choice. The style in which the selected value is displayed, and the style of the popup is determined by the current theme. It may be similar to a Windows-style combo box.
The GtkComboBox uses the model-view pattern; the list of valid choices is specified in the form of a tree model, and the display of the choices can be adapted to the data in the model by using cell renderers, as you would in a tree view. This is possible since GtkComboBox implements the Gtk.CellLayout interface. The tree model holding the valid choices is not restricted to a flat list, it can be a real tree, and the popup will reflect the tree structure.
To allow the user to enter values not in the model, the 'has-entry' property allows the GtkComboBox to contain a Gtk.Entry. This entry can be accessed by calling Gtk.Bin.prototype.get_child on the combo box.
For a simple list of textual choices, the model-view API of GtkComboBox can be a bit overwhelming. In this case, Gtk.ComboBoxText offers a simple alternative. Both GtkComboBox and Gtk.ComboBoxText can contain an entry.
Hierarchy
-
GObject.Object
-
GObject.InitiallyUnowned
-
Gtk.Widget
-
Gtk.Container
-
Gtk.Bin
- Gtk.ComboBox
-
-
-
-
Methods
- Gtk.ComboBox.prototype.get_active
- Gtk.ComboBox.prototype.get_active_id
- Gtk.ComboBox.prototype.get_active_iter
- Gtk.ComboBox.prototype.get_add_tearoffs
- Gtk.ComboBox.prototype.get_button_sensitivity
- Gtk.ComboBox.prototype.get_column_span_column
- Gtk.ComboBox.prototype.get_entry_text_column
- Gtk.ComboBox.prototype.get_focus_on_click
- Gtk.ComboBox.prototype.get_has_entry
- Gtk.ComboBox.prototype.get_id_column
- Gtk.ComboBox.prototype.get_model
- Gtk.ComboBox.prototype.get_popup_accessible
- Gtk.ComboBox.prototype.get_popup_fixed_width
- Gtk.ComboBox.prototype.get_row_span_column
- Gtk.ComboBox.prototype.get_title
- Gtk.ComboBox.prototype.get_wrap_width
- Gtk.ComboBox.prototype.popdown
- Gtk.ComboBox.prototype.popup
- Gtk.ComboBox.prototype.popup_for_device
- Gtk.ComboBox.prototype.set_active
- Gtk.ComboBox.prototype.set_active_id
- Gtk.ComboBox.prototype.set_active_iter
- Gtk.ComboBox.prototype.set_add_tearoffs
- Gtk.ComboBox.prototype.set_button_sensitivity
- Gtk.ComboBox.prototype.set_column_span_column
- Gtk.ComboBox.prototype.set_entry_text_column
- Gtk.ComboBox.prototype.set_focus_on_click
- Gtk.ComboBox.prototype.set_id_column
- Gtk.ComboBox.prototype.set_model
- Gtk.ComboBox.prototype.set_popup_fixed_width
- Gtk.ComboBox.prototype.set_row_separator_func
- Gtk.ComboBox.prototype.set_row_span_column
- Gtk.ComboBox.prototype.set_title
- Gtk.ComboBox.prototype.set_wrap_width