[Glade-users] gtk_combo_box_append_text() problem



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jonathan at blueplanet.cl wrote:
Hi,

Basically in my C code I get the comboBox with gtk_builder_get_object()
and then call gtk_combo_box_append_text() this gives me an error:

(gmpg:12154): Gtk-CRITICAL **: gtk_combo_box_append_text: assertion
`GTK_IS_LIST_STORE (combo_box->priv->model)' failed

Did you created the GtkListStore model for that combo box? That warning
was produced because you didn't set the proper model.

Check the info of gtk_combo_box_set_model ().


Thanks All for getting back to me,

I'm a bit confused by the GtkListStore model now. If I want to just
store a list of strings I create a GtkListStore:

    GtkListStore            *list_store;
    list_store = gtk_list_store_new (1, G_TYPE_STRING);

Now set this to be the model of my combobox:

    gtk_combo_box_set_model((GtkComboBox *) MyComboBox,
                            (GtkTreeModel *)list_store);

That has gotten rid of the error message OK but I can't add to the list
of items in the combobox. I've tried adding to the ListStore and the
Combobox but nothing shows up when I display the interface.

    GtkTreeIter iter;

    /* Add a new row to the model */
    gtk_list_store_append (list_store, &iter);
    gtk_list_store_set (list_store, &iter, 0, "Hello", -1);

    /* Simply add to the combobox */
    gtk_combo_box_append_text((GtkComboBox *)vehicleList, "Hello");


Neither of those two methods raise an error on compile time but nothing
is in the drop down list at all?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI/YlWXlbjSJ5n4BARAqfqAJ9JW10LnXnCkv1xjNCaVkaDWyWPqQCfcTTY
KN+klpRVEb4voet9L4SSNF8=
=gdpy
-----END PGP SIGNATURE-----




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