Main Page Widgets Namespaces Book

# Gtk::ComboBoxEntry Class Reference
[Widgets]

Inheritance diagram for Gtk::ComboBoxEntry:

[legend]

List of all members.

## Detailed Description

A text entry field with a dropdown list.

A ComboBoxEntry 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 ComboBox, but it displays the selected value in an entry to allow modifying it.

In contrast to a ComboBox, the underlying model of a ComboBoxEntry must always have a text column (see 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 get_active_text().

The changed signal will be emitted while typing into a ComboBoxEntry, as well as when selecting an item from the ComboBoxEntry's list. Use get_active() to discover whether an item was actually selected from the list.

See also ComboBoxEntryText, which is specialised for a single text column.

To add and remove strings from the list, just modify the model using its data manipulation API. You can get the Entry by using get_child().

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().

The ComboBoxEntry widget looks like this:

## Public Member Functions
| ComboBoxEntry (const Glib::RefPtr<TreeModel>& model, int text_column=0)
| Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup.
| ComboBoxEntry (const Glib::RefPtr<TreeModel>& model, const TreeModelColumnBase& text_column)
| Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup.
| ComboBoxEntry ()
Glib::ustring | get_active_text () const
| Returns the currently active string.
const Entry* | get_entry () const
Entry* | get_entry ()
int | get_text_column () const
| Return value: A column in the data source model of entry_box.
const GtkComboBoxEntry* | gobj () const
| Provides access to the underlying C GtkObject.
GtkComboBoxEntry* | gobj ()
| Provides access to the underlying C GtkObject.
void | set_text_column (int text_column) const
| Sets the model column which entry_box should use to get strings from to be text_column.
void | set_text_column (const TreeModelColumnBase& text_column) const
| Sets the model column which entry_box should use to get strings from to be text_column.
virtual | ~ComboBoxEntry ()
## Related Functions
(Note that these are not member functions.)
Gtk::ComboBoxEntry* | wrap (GtkComboBoxEntry* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Constructor & Destructor Documentation

virtual Gtk::ComboBoxEntry::~ComboBoxEntry | ( |  | ) | `[virtual]`

Gtk::ComboBoxEntry::ComboBoxEntry | ( |  | ) |

Gtk::ComboBoxEntry::ComboBoxEntry | ( | const Glib::RefPtr<TreeModel>& | model,
|  | const TreeModelColumnBase& | text_column |
| ) |  |  | `[explicit]`

Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup.

You can get the Entry from a ComboBoxEntry using get_entry(). To add and remove strings from the list, just modify model using its data manipulation API.

Parameters:

  | model | A TreeModel.
  | text_column | A column in model to get the strings from.

Gtk::ComboBoxEntry::ComboBoxEntry | ( | const Glib::RefPtr<TreeModel>& | model,
|  | int | text_column = `0` |
| ) |  |  | `[explicit]`

Creates a new ComboBoxEntry which has an Entry as child and a list of strings as popup.

You can get the Entry from a ComboBoxEntry using get_entry(). To add and remove strings from the list, just modify model using its data manipulation API.

Parameters:

  | model | A TreeModel.
  | text_column | A column in model to get the strings from.

## Member Function Documentation

Glib::ustring Gtk::ComboBoxEntry::get_active_text | ( |  | ) | const

Returns the currently active string.

Returns:
  The currently active text.

Since gtkmm 2.14:

Reimplemented in Gtk::ComboBoxEntryText.

const Entry* Gtk::ComboBoxEntry::get_entry | ( |  | ) | const

See also:
  Bin::get_child().

Entry* Gtk::ComboBoxEntry::get_entry | ( |  | ) |

See also:
  Bin::get_child().

int Gtk::ComboBoxEntry::get_text_column | ( |  | ) | const

Return value: A column in the data source model of entry_box.

Returns:
  A column in the data source model of entry_box.

Since gtkmm 2.4:

const GtkComboBoxEntry* Gtk::ComboBoxEntry::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::ComboBox.

GtkComboBoxEntry* Gtk::ComboBoxEntry::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::ComboBox.

void Gtk::ComboBoxEntry::set_text_column | ( | int | text_column | ) | const

Sets the model column which entry_box should use to get strings from to be text_column.

Since gtkmm 2.4:

Parameters:

  | text_column | A column in model to get the strings from.

void Gtk::ComboBoxEntry::set_text_column | ( | const TreeModelColumnBase& | text_column | ) | const

Sets the model column which entry_box should use to get strings from to be text_column.

Since gtkmm 2.4:

Parameters:

  | text_column | A column in model to get the strings from.

## Friends And Related Function Documentation

Gtk::ComboBoxEntry* wrap | ( | GtkComboBoxEntry * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- comboboxentry.h