[Gtk-sharp-list] CellRendererToggle Help!
John Luke
jluke@users.sourceforge.net
Fri, 16 Apr 2004 00:19:14 -0400
On Thu, 2004-04-15 at 23:10 -0400, Joe Scaduto wrote:
> Hello,
>
> I currently have a ListStore with 3 columns appended and one whose
> CellRenderer is CellRendererToggle. Since the CellRendererToggle is for
> the entire column I am not quite sure how to change the state of one of
> the checkboxes. The following code updates the value in the store for
> the appropriate cell but the check box does not reflect this; either it
> stays checked or does not. Any help would be greatly appreciated.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> public void SelectCommunity(object obj, ToggledArgs e)
> {
> TreeModel listModel = treeview.Model;
> TreeIter iter;
>
> listModel.GetIterFromString(out iter, e.Path);
>
> bool check = (bool)listModel.GetValue(iter,0);
>
> if (check == false)
> communityStore.SetValue(iter,0,true);
> else
> communityStore.SetValue(iter,0,false);
>
> treeview.Model = communityStore;
> }
>
I always forget how to do this myself, but GtkDemo uses this and perhaps
it could help you. I think it's something simple like setting the column
Activatable or something. See gtk-sharp/samples/GtkDemo/