here is an example of a simple, but typical use of a gtkcombo:
gtkwidget *combo;
glist *items = null;
items = g_list_append (items, "first item");
items = g_list_append (items, "second item");
items = g_list_append (items, "third item");
combo = gtk_combo_new ();
gtk_combo_set_popdown_strings (gtk_combo (combo), items);
in order to react to the user's selection, connect to the "changed" signal on the combo and use gtk_entry_get_text (gtk_entry (combo->entry)) to retrieve the selected text. and here is how it would be done using gtkcomboboxentry:
combo_box = gtk_combo_box_entry_new_text ();
gtk_combo_box_append_text (gtk_combo_box (combo_box), "first item");
gtk_combo_box_append_text (gtk_combo_box (combo_box), "second item");
gtk_combo_box_append_text (gtk_combo_box (combo_box), "third item");
in order to react to the user's selection, connect to the "changed" signal on the combo and use gtk_entry_get_text (gtk_entry (gtk_bin (combo_box)->child)) to retrieve the selected text. |