Re: Simple ComboBoxEntry question



Dnia 15-08-2004, nie o godzinie 15:25 +0200, John Oxley napisał:
Hi,

I am new to coding with the GTK+ toolkit.  I am fairly fluent in both C
and C++.  I am developing a run dialog box, similar to grun, but I want
to add some things into it, and also learn GTK.  I am using Glade-2 for
the UI and gtk-2.4.0

As a starting point, when I click the OK button, I want "foo" to be
added to a GtkComboBoxEntry.  This is the code that I have written to do
so:

void on_btn_ok_clicked (GtkButton *button, gpointer user_data) { // {{{ 
   GtkWidget *cmdCombo = lookup_widget(GTK_WIDGET(button),
"cmb_cmdLine");
   gtk_combo_box_append_text (GTK_COMBO_BOX (cmdCombo), "foobar");
} // }}}

When I run the program, and I get this line thrown at me:
(orun:46734): Gtk-CRITICAL **: file gtktreemodel.c: line 998
(gtk_tree_model_get_iter_first): assertion `GTK_IS_TREE_MODEL
(tree_model)' failed

and when I click on "OK", I get the following:
(orun:46734): Gtk-CRITICAL **: file gtkcombobox.c: line 3299
(gtk_combo_box_append_text): assertion `GTK_IS_LIST_STORE
(combo_box->priv->model)' failed

From the glade build, the only file I have modified is callbacks.c

Don't remember offhand if glade does that automatically, but did you
associate GtkTreeModel with GtkComboBox? Also, I see you use glade-
generated code in your app. One word: DON'T. It's unfortunate that glade
gives such a misleading info in its manual, but using glade generated
code is one of the worst things you can do in your apps. If you can
depend on libglade, by any means do it and use .glade XML files
directly.

Here is introductory article in libglade:
http://www-106.ibm.com/developerworks/library/l-gnome-glade/
It's Gtk1.2 based, but gives overview of idea behind linglade, and as
usual, google knows it all :)

HTH,
Maciej

-- 
"Tautologizm to coś tautologicznego"
   Maciej Katafiasz <mnews2 wp pl>
       http://mathrick.blog.pl




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]