J
Joona I Palaste
giorgix said:Hi folks!
I'm working with gtk+ 2 on windows.
I created with Glade my interface and now i add my own code.
I have difficult to retrieve text from a combo box.
This is the code (from callbacks.c file, generated by Glade):
1 void
2 on_bt_ok_clicked (GtkButton *button,
3 gpointer user_data)
4 {
5 GtkWidget *entry1 = lookup_widget(GTK_WIDGET(button), "committente");
6 gchar *committente = gtk_entry_get_text(GTK_ENTRY(entry1));
[...]
7 GtkWidget *entry4 = lookup_widget(GTK_WIDGET(button), "comune_combo");
8 gchar *comune_combo = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO (entry4)->entry));
[...]
9 }
This code is a callback for a button's pression.
lookup_widget() is a function provided by Glade, that returns
the pointer of a widget.
On lines 5-6 i retrieve the input from a text field and it works.
On lines 7-8 i'm trying to do the same thing with a combo box.
I can compile and run the application, but when I click the button
I get the error: "Gtk-CRIRTICAL **: file gtkentry.c: line 3437
<gtk_entry_get_text>: assertion 'GTK_IS_ENTRY <entry>' failed".
I found the code on the official gtk+2 tutorial, so i guess it's
correct, so why doesn't work?
Cheers, Gio
GTK+2 is not a standard C feature, so therefore it's off-topic here.
Please ask in comp.unix.programmer or a suitable GTK newsgroup.
Thanks.