[Gtk-sharp-list] CellRendererToggle Help!

Joe Scaduto scooch@noggle.biz
Thu, 15 Apr 2004 23:10:26 -0400


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;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks,

Joe