A text entry field with a dropdown list
Class GtkComboBoxEntry
A GtkComboBoxEntry is a widget that allows the user to choose from a list of valid choices or enter a different value. It is very similar to a GtkComboBox, but it displays the selected value in an entry to allow modifying it.
In contrast to a GtkComboBox, the underlying model of a GtkComboBoxEntry must always have a text column (see gtk_combo_box_entry_set_text_column()), and the entry will show the content of the text column in the selected row. To get the text from the entry, use gtk_combo_box_get_active_text().
The changed signal will be emitted while typing into a GtkComboBoxEntry, as well as when selecting an item from the GtkComboBoxEntry's list. Use gtk_combo_box_get_active() or gtk_combo_box_get_active_iter() to discover whether an item was actually selected from the list.
Connect to the activate signal of the GtkEntry (use gtk_bin_get_child()) to detect when the user actually finishes entering text.
The convenience API to construct simple text-only GtkComboBoxes can also be used with GtkComboBoxEntrys which have been constructed with gtk_combo_box_entry_new_text().
If you have special needs that go beyond a simple entry (e.g. input validation), it is possible to replace the child entry by a different widget using gtk_container_remove() and gtk_container_add().
Methods | |
get_text_column | Returns the column which entry_box is using to get the strings from. |
new_text | Create a new text GtkComboBoxEntry. |
set_text_column | Sets the model column which entry_box should use to get strings from to be text_column. |
Returns the column which entry_box is using to get the strings from.
GtkComboBoxEntry.get_text_column()
Return | A column in the data source model of entry box. |
Create a new text GtkComboBoxEntry.
GtkComboBoxEntry.new_text()
Convenience function which constructs a new editable text combo box, which is a GtkComboBoxEntry just displaying strings. If you use this function to create a text combo box, you should only manipulate its data source with the following convenience functions: append_text(), insert_text(), prepend_text() and remove_text().
Sets the model column which entry_box should use to get strings from to be text_column.
GtkComboBoxEntry.set_text_column( text_column )
text_column | A column in model to get the strings from. |