Re: Gtkcombo
- From: Carlos Pereira <carlos pehoe civil ist utl pt>
- To: gtk-app-devel-list gnome org
- Subject: Re: Gtkcombo
- Date: Tue, 20 Feb 2001 20:41:56 GMT
i would like to know which is the position of the element placed in the
combo's gtkentry.
that is: if i have a popdown menu with 3 possibilities and i choose the
third one, i want to obtain 3,(or 2 if it starts from 0)
Something like this will do:
(Glib might provide a function to get the order directly, don't know.)
Carlos
/* to create the combo: */
combo = gtk_combo_new ();
gtk_widget_set_usize (GTK_WIDGET (combo), 60, 0);
gtk_box_pack_start (GTK_BOX (vbox1), combo, FALSE, FALSE, 0);
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo)->entry), "a");
glist = g_list_append (glist, "a");
glist = g_list_append (glist, "b");
glist = g_list_append (glist, "c");
gtk_combo_set_popdown_strings (GTK_COMBO (combo), glist);
gtk_object_set_data (GTK_OBJECT (dialog), "my_combo_box", combo);
gtk_widget_show (combo);
/* in the callback: */
combo = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "my_combo_box");
name = gtk_entry_get_text (GTK_ENTRY (GTK_COMBO (combo)->entry));
if (strcmp (name, "a") == 0) order = 1;
else if (strcmp (name, "b") == 0) order = 2;
else if (strcmp (name, "c") == 0) order = 3;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]