8.2. Editable Toggle and Radio Button Cells

Just like you can set a GTree.cell_renderer_text editable, you can specify whether a GTree.cell_renderer_toggle should change its state when clicked by setting the `ACTIVATABLE property - either when you create the renderer (in which case all cells in that column will be clickable) or by connecting the renderer property to a model column of boolean type via attributes.

Connect to the "toggled" signal of the toggle cell renderer to be notified when the user clicks on a toggle button (or radio button). The user click will not change the value in the store, or the appearance of the value rendered. The toggle button will only change state when you update the value in the store. Until then it will be in an "inconsistent" state, which is also why you should read the current value of that cell from the model, and not from the cell renderer.

The "toggled" signal callback looks like this:


method toggled : callback:(Gtk.tree_path -> unit) -> GtkSignal.id

Just like with the "edited" signal of the text cell renderer, the tree path is passed to the "toggled" signal callback. You can convert it into an iter with GTree.model#get_iter.