gtk.combo_box
Module for [ComboBox] class
Types 3
A gtk.combo_box.ComboBox is a widget that allows the user to choose from a list of valid choices.
The gtk.combo_box.ComboBox displays the selected choice; when activated, the gtk.combo_box.ComboBox displays a popup which allows the user to make a new choice.
The gtk.combo_box.ComboBox 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 gtk.combo_box.ComboBox implements the gtk.cell_layout.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 gtk.combo_box.ComboBox.hasEntry property allows the gtk.combo_box.ComboBox to contain a gtk.entry.Entry. This entry can be accessed by calling gtk.combo_box.ComboBox.getChild on the combo box.
For a simple list of textual choices, the model-view API of gtk.combo_box.ComboBox can be a bit overwhelming. In this case, gtk.combo_box_text.ComboBoxText offers a simple alternative. Both gtk.combo_box.ComboBox and gtk.combo_box_text.ComboBoxText can contain an entry.
CSS nodes
combobox
├── box.linked
│ ╰── button.combo
│ ╰── box
│ ├── cellview
│ ╰── arrow
╰── window.popupA normal combobox contains a box with the .linked class, a button with the .combo class and inside those buttons, there are a cellview and an arrow.
combobox
├── box.linked
│ ├── entry.combo
│ ╰── button.combo
│ ╰── box
│ ╰── arrow
╰── window.popupA gtk.combo_box.ComboBox with an entry has a single CSS node with name combobox. It contains a box with the .linked class. That box contains an entry and a button, both with the .combo class added. The button also contains another node with name arrow.
Accessibility
gtk.combo_box.ComboBox uses the gtk.types.AccessibleRole.ComboBox role.
Deprecated
ComboBoxGidBuilder builder() static nothrowGet builder for [gtk.combo_box.ComboBox] Returns: New builder objectvoid active(int propval) @property nothrowSet `active` property. Params: propval = The item which is currently active.string activeId() @property nothrowGet `activeId` property. Returns: The value of the ID column of the active row.void activeId(string propval) @property nothrowSet `activeId` property. Params: propval = The value of the ID column of the active row.gtk.types.SensitivityType buttonSensitivity() @property nothrowGet `buttonSensitivity` property. Returns: Whether the dropdown button is sensitive when the model is empty.void buttonSensitivity(gtk.types.SensitivityType propval) @property nothrowSet `buttonSensitivity` property. Params: propval = Whether the dropdown button is sensitive when the model is empty.void child(gtk.widget.Widget propval) @property nothrowSet `child` property. Params: propval = The child widget.int entryTextColumn() @property nothrowGet `entryTextColumn` property. Returns: The model column to associate with strings from the entry.void entryTextColumn(int propval) @property nothrowSet `entryTextColumn` property. Params: propval = The model column to associate with strings from the entry.bool hasEntry() @property nothrowGet `hasEntry` property. Returns: Whether the combo box has an entry.bool hasFrame() @property nothrowGet `hasFrame` property. Returns: The `has-frame` property controls whether a frame is drawn around the entry.void hasFrame(bool propval) @property nothrowSet `hasFrame` property. Params: propval = The `has-frame` property controls whether a frame is drawn around the entry.int idColumn() @property nothrowGet `idColumn` property. Returns: The model column that provides string IDs for the values in the model, if != -1.void idColumn(int propval) @property nothrowSet `idColumn` property. Params: propval = The model column that provides string IDs for the values in the model, if != -1.gtk.tree_model.TreeModel model() @property nothrowGet `model` property. Returns: The model from which the combo box takes its values.void model(gtk.tree_model.TreeModel propval) @property nothrowSet `model` property. Params: propval = The model from which the combo box takes its values.bool popupFixedWidth() @property nothrowGet `popupFixedWidth` property. Returns: Whether the popup's width should be a fixed width matching the allocated width of the combo box.void popupFixedWidth(bool propval) @property nothrowSet `popupFixedWidth` property. Params: propval = Whether the popup's width should be a fixed width matching the allocated width of the combo box.bool popupShown() @property nothrowGet `popupShown` property. Returns: Whether the combo boxes dropdown is popped up.gtk.combo_box.ComboBox newWithEntry() static nothrowCreates a new empty [gtk.combo_box.ComboBox] with an entry.gtk.combo_box.ComboBox newWithModel(gtk.tree_model.TreeModel model) static nothrowCreates a new [gtk.combo_box.ComboBox] with a model.gtk.combo_box.ComboBox newWithModelAndEntry(gtk.tree_model.TreeModel model) static nothrowCreates a new empty [gtk.combo_box.ComboBox] with an entry and a model.bool getActiveIter(out gtk.tree_iter.TreeIter iter) nothrowSets iter to point to the currently active item.gtk.types.SensitivityType getButtonSensitivity() nothrowReturns whether the combo box sets the dropdown button sensitive or not when there are no items in the model. Returns: [gtk.types.SensitivityType.On] if the dropdown button is sensitive when the mo...gtk.widget.Widget getChild() nothrowGets the child widget of combo_box. Returns: the child widget of combo_boxint getEntryTextColumn() nothrowReturns the column which combo_box is using to get the strings from to display in the internal entry. Returns: A column in the data source model of combo_box.bool getHasEntry() nothrowReturns whether the combo box has an entry. Returns: whether there is an entry in combo_box.int getIdColumn() nothrowReturns the column which combo_box is using to get string IDs for values from. Returns: A column in the data source model of combo_box.gtk.tree_model.TreeModel getModel() nothrowReturns the [gtk.tree_model.TreeModel] of combo_box. Returns: A [gtk.tree_model.TreeModel] which was passed during construction.bool getPopupFixedWidth() nothrowGets whether the popup uses a fixed width. Returns: true if the popup uses a fixed widthbool setActiveId(string activeId = null) nothrowChanges the active row of combo_box to the one that has an ID equal to active_id.void setActiveIter(gtk.tree_iter.TreeIter iter = null) nothrowSets the current active item to be the one referenced by iter.void setButtonSensitivity(gtk.types.SensitivityType sensitivity) nothrowSets whether the dropdown button of the combo box should update its sensitivity depending on the model contents.void setEntryTextColumn(int textColumn) nothrowSets the model column which combo_box should use to get strings from to be text_column.void setIdColumn(int idColumn) nothrowSets the model column which combo_box should use to get string IDs for values from.void setModel(gtk.tree_model.TreeModel model = null) nothrowSets the model used by combo_box to be model.void setPopupFixedWidth(bool fixed) nothrowSpecifies whether the popup’s width should be a fixed width.void setRowSeparatorFunc(gtk.types.TreeViewRowSeparatorFunc func = null) nothrowSets the row separator function, which is used to determine whether a row should be drawn as a separator.gulong connectActivate(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.combo_box.ComboBox)))
&& Parameters!T.length < 2) nothrowConnect to `Activate` signal.gulong connectChanged(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.combo_box.ComboBox)))
&& Parameters!T.length < 2) nothrowConnect to `Changed` signal.gulong connectFormatEntryText(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == string)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == string)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.combo_box.ComboBox)))
&& Parameters!T.length < 3) nothrowConnect to `FormatEntryText` signal.gulong connectMoveActive(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == gtk.types.ScrollType)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gtk.combo_box.ComboBox)))
&& Parameters!T.length < 3) nothrowConnect to `MoveActive` signal.gulong connectPopdown(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.combo_box.ComboBox)))
&& Parameters!T.length < 2) nothrowConnect to `Popdown` signal.gulong connectPopup(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gtk.combo_box.ComboBox)))
&& Parameters!T.length < 2) nothrowConnect to `Popup` signal.Fluent builder implementation template for gtk.combo_box.ComboBox
T active(int propval) nothrowSet `active` property. Params: propval = The item which is currently active.T activeId(string propval) nothrowSet `activeId` property. Params: propval = The value of the ID column of the active row. Returns: Builder instance for fluent chainingT buttonSensitivity(gtk.types.SensitivityType propval) nothrowSet `buttonSensitivity` property. Params: propval = Whether the dropdown button is sensitive when the model is empty. Returns: Builder instance for fluent chainingT child(gtk.widget.Widget propval) nothrowSet `child` property. Params: propval = The child widget. Returns: Builder instance for fluent chainingT entryTextColumn(int propval) nothrowSet `entryTextColumn` property. Params: propval = The model column to associate with strings from the entry.T hasEntry(bool propval) nothrowSet `hasEntry` property. Params: propval = Whether the combo box has an entry. Returns: Builder instance for fluent chainingT hasFrame(bool propval) nothrowSet `hasFrame` property. Params: propval = The `has-frame` property controls whether a frame is drawn around the entry. Returns: Builder instance for fluent chainingT idColumn(int propval) nothrowSet `idColumn` property. Params: propval = The model column that provides string IDs for the values in the model, if != -1. Returns: Builder instance for fluent chainingT model(gtk.tree_model.TreeModel propval) nothrowSet `model` property. Params: propval = The model from which the combo box takes its values. Returns: Builder instance for fluent chainingT popupFixedWidth(bool propval) nothrowSet `popupFixedWidth` property. Params: propval = Whether the popup's width should be a fixed width matching the allocated width of the combo box. Returns: Builder instance for fluent chainingFluent builder for gtk.combo_box.ComboBox