I have a combo render in a treeview and I can't get the callback to set the value once it's selected. I want the combo to default to "Stock" but be able to be changed to any of the other values in the itemtype array. Below is the way the item type combo is being created and added to the tree view followed by the callback. Does any one see the error?
Thanks, --dhk GtkListStore *ls_combo=NULL; . . . /* --- ItemType Treeview Column --- */ renderer = gtk_cell_renderer_combo_new(); /* Create the combo box */ ls_combo=gtk_list_store_new(1, G_TYPE_STRING); for(ii=0; ii<9; ii++) { gtk_list_store_append (ls_combo, &iter); gtk_list_store_set (ls_combo, &iter, 0, itemtype[ii], -1); } g_object_set(G_OBJECT(renderer), "model", ls_combo, "text-column", 0, "text", "Stock", "has-entry", FALSE, "editable", TRUE, NULL); g_signal_connect(renderer, "edited", G_CALLBACK(itemTypeComboEditedCb), ls_combo); /* Create a Column */ column=gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, "ItemType"); gtk_tree_view_column_pack_start(column, renderer, FALSE); ips=IPS_ItemType; // gtk_tree_view_column_set_attributes(column, renderer, "text", ips, NULL); col_num=gtk_tree_view_insert_column(GTK_TREE_VIEW(tv), column, -1); g_object_unref(ls_combo); /* FIELD is the column number not the index: always one more than index. */ g_object_set_data(G_OBJECT(renderer), "FIELD", GUINT_TO_POINTER(col_num)); /* -------------- */ /* The callback */ void itemTypeComboEditedCb(GtkCellRendererText *cell, const gchar *path, const gchar *value, GtkListStore *list) { gboolean rc=FALSE; GtkTreeIter iter; GtkTreePath *tp=NULL; GtkTreeModel *tm=NULL; /* a tree model */ gint col_num=0; tp=gtk_tree_path_new_from_string(path); col_num=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cell), "FIELD")); gtk_tree_model_get_iter (GTK_TREE_MODEL(list), &iter, tp); gtk_list_store_set(list, &iter, 0, value, -1); /* The following sets the whole column to the same value, not just the row it was select in. */ //g_object_set(G_OBJECT(cell), "text", value, NULL); } _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list