GtkComboBox Constructor

GtkComboBox (GtkTreeModel model);

Creates a new GtkComboBox associated with the optional GtkTreeModel specified by model. If model is not specified the combo box will not have an associated tree model.

Example 49. Creating a GtkLabel

// Create a new window.
$window = new GtkWindow();

// Set the window up to close cleanly.
$window->connect_simple('destroy', array('Gtk', 'main_quit'));

// Create a text combobox.
$combo = new GtkComboBox();

// Create a model.
$listStore = new GtkListStore(Gtk::TYPE_STRING);

// Add some values.
$listStore->append(array('New Jersey'));
$listStore->append(array('New Mexico'));
$listStore->append(array('New York'));

// Set the model for the combo.

// Create a cell renderer.
$cellRenderer = new GtkCellRendererText();

// Pack the cell renderer into the combo.

// Tell the combo where to get the text value of the cell renderer.
$combo->set_attributes($cellRenderer, 'text', 0);

// Add the combobox to the window.

// Show the window and its contents.

// Start the main loop.