Re: setting check buttons in treeview



Rob Clack wrote:

I'm using gtk 2.2.4 and Red Hat 9.

I have a variable list of "things" my users can switch on and off, so I populated a treeview with check buttons and text, stuck that in a scrolled window and put that in the new window.
This may not be the best way to do what I want, so I'm quite happy to 
hear suggestions of alternatives, which is why I'm posting to this 
newsgroup.  However, assuming I'm headed in the right direction, I now 
have a problem.
The list displays fine and I can preset the check buttons to ON or 
OFF, and when I click a button my callback gets called and I can 
detect the current setting.
The difficulty is setting the button to it's opposite toggle value. ie 
if it's ON and I click it, it should be set to OFF.  I found a posting 
by Bijoy Chandrasekharan dated May 2003 in which he did what I want, thus
gtk_tree_store_set(GTK_TREE_STORE(model), &iter, BUTTON, FALSE);

but when I run this I get gtk errors:

(cols:29538): GLib-GObject-WARNING **: invalid cast from `GtkTreeModelSort' to `GtkTreeStore'
(cols:29538): Gtk-CRITICAL **: file gtktreestore.c: line 1039 
(gtk_tree_store_set): assertion `GTK_IS_TREE_STORE (tree_store)' failed
you need to call gtk_tree_store_set() using the GtkTreeStore (your 
"tree" pointer), not the GtkTreeModelSort (your "model" pointer).  if 
"iter" is in relation to "model", you'll have to use the 
GtkTreeModelSort functions to convert it to a GtkTreeIter in relation to 
"tree".
   -brian




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