[Gtk-sharp-list] Help with GtkCellRendererToggle in a listview

alan battersby alan.battersby at ntlworld.com
Fri Mar 6 13:06:36 EST 2009

Can you change the value of a GtkCellRendererToggle in a treeview and If
so how?   I have allowed buttonpress and button release events for the
view, and my code for the togglebutton is

private void RenderCol1 (Gtk.TreeViewColumn column, Gtk.CellRenderer
cell, Gtk.TreeModel model, Gtk.TreeIter iter)
            TreestoreData item = (TreestoreData)model.GetValue (iter, 0);
            if (item.ispath)
                cell.Visible = true;
                (cell as Gtk.CellRendererToggle).Sensitive = true;
                (cell as Gtk.CellRendererToggle).Mode =
                (cell as Gtk.CellRendererToggle).Toggled += HandleToggled;
                (cell as Gtk.CellRendererToggle).Active = item.included;
                cell.Visible = false;           

Nothing happens when I try to click the button. Can someone tell me
where I am going wrong or what I am missing. Ive looked at Gtk+ 2.0
Treeview tutorial by Tim-Philipp Müller but  didnt see anything to help
me. Also how do I access the item associated with the button in the
toggled event handler as Im not sure that toggling the button would
result in a selection?


More information about the Gtk-sharp-list mailing list