Basics
Guides
API Reference
Basics
Guides
API Reference
[38:7] extends: object
A GtkComboBoxText is a simple variant of GtkComboBox for text-only use
cases.
GtkComboBoxText hides the model-view
complexity of GtkComboBox. To create a GtkComboBoxText, use
[ctor@Gtk.ComboBoxText.new] or [ctor@Gtk.ComboBoxText.new_with_entry]. You
can add items to a GtkComboBoxText with
[method@Gtk.ComboBoxText.append_text], [method@Gtk.ComboBoxText.insert_text]
or [method@Gtk.ComboBoxText.prepend_text] and remove options with
[method@Gtk.ComboBoxText.remove]. If the GtkComboBoxText contains an entry
(via the [property@Gtk.ComboBox:has-entry] property), its contents can be
retrieved using [method@Gtk.ComboBoxText.get_active_text]. You should not
call [method@Gtk.ComboBox.set_model] or attempt to pack more cells into this
combo box via its [iface@Gtk.CellLayout] interface. ## GtkComboBoxText as
GtkBuildable The GtkComboBoxText implementation of the GtkBuildable
interface supports adding items directly using the <items> element and
specifying <item> elements for each item. Each <item> element can specify
the “id” corresponding to the appended text and also supports the regular
translation attributes “translatable”, “context” and “comments”. Here is a UI
definition fragment specifying GtkComboBoxText items: xml <object class="GtkComboBoxText"> <items> <item translatable="yes" id="factory">Factory</item> <item translatable="yes" id="home">Home</item> <item translatable="yes" id="subway">Subway</item> </items> </object> ##
CSS nodes combobox ╰── box.linked ├── entry.combo ├── button.combo ╰── window.popup GtkComboBoxText has a single CSS node with name combobox.
It adds the style class .combo to the main CSS nodes of its entry and button
children, and the .linked class to the node of its internal box.
ComboBoxText ()
Creates a new
GtkComboBoxText.
toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asComboBox ()
Wraps this handle as
ComboBox.
A ComboBox object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asCellEditable ()
Wraps this handle as
CellEditable.
A CellEditable object.asCellLayout ()
Wraps this handle as
CellLayout.
A CellLayout object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.append (string id, string text)
Appends @text to the list of strings stored in @combo_box. If @id is non-%NULL then it is used as the ID of the row. This is the same as calling [method@Gtk.ComboBoxText.insert] with a position of -1.
id is a string ID for this value.text is A string.None.append_text (string text)
Appends @text to the list of strings stored in @combo_box. This is the same as calling [method@Gtk.ComboBoxText.insert_text] with a position of -1.
text is A string.None.get_active_text ()
Returns the currently active string in @combo_box. If no row is currently selected, %NULL is returned. If @combo_box contains an entry, this function will return its contents (which will not necessarily be an item from the list).
insert (int position, string id, string text)
Inserts @text at @position in the list of strings stored in @combo_box. If @id is non-%NULL then it is used as the ID of the row. See [property@Gtk.ComboBox:id-column]. If @position is negative then @text is appended.
position is An index to insert @text.id is a string ID for this value.text is A string to display.None.insert_text (int position, string text)
Inserts @text at @position in the list of strings stored in @combo_box. If @position is negative then @text is appended. This is the same as calling [method@Gtk.ComboBoxText.insert] with a %NULL ID string.
position is An index to insert @text.text is A string.None.prepend (string id, string text)
Prepends @text to the list of strings stored in @combo_box. If @id is non-%NULL then it is used as the ID of the row. This is the same as calling [method@Gtk.ComboBoxText.insert] with a position of 0.
id is a string ID for this value.text is a string.None.prepend_text (string text)
Prepends @text to the list of strings stored in @combo_box. This is the same as calling [method@Gtk.ComboBoxText.insert_text] with a position of 0.
text is A string.None.remove (int position)
Removes the string at @position from @combo_box.
position is Index of the item to remove.None.remove_all ()
Removes all the text entries from the combo box.
None.[287:14] static extends: object
Alternate constructors for ComboBoxText. Usage:
ComboBoxTextCtors.<name>(...). The primary constructor lives
directly on ComboBoxText.
newWithEntry ()
Creates a new
GtkComboBoxTextwith an entry.
A new ComboBoxText.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.