Re: gtk_cell_renderer_toggle_new()



On Mon, Aug 27, 2007 at 07:33:54AM -0400, dhk wrote:
Why do all toggles get activated or deactivated in a treeview when only
one gets clicked?  Also, moving the mouse over the rows seems to
redisplay the toggles as checked or unchecked depending on the value of
the last toggle.

I'm not sure what exactly you do (I cannot see any code
posted) but likely you use the cell renderer wrong.

The cell renderer is one and it is used to render cells in
all rows.  The look is determined by its properties at the
moment the rendering is performed.  Something has to set its
properties before rednering each cell to defined how this
particular cell should be rendered.  This is done by any
combination of:

- binding a property to a model column with (e.g.)
  gtk_tree_view_column_add_attribute()

- sepcifying a cell data function called before rendering each
  cell with gtk_tree_view_column_set_cell_data_func(), that
  sets the properties with g_object_set()

- setting the properties globally with g_object_set() -- only
  possible for those that are the same for all rows

See for instance the Gtk+ demo (or the source code of any
Gtk+ application that has a tree view with toggles) for
a correct use of cell renderers.

Yeti

--
http://gwyddion.net/



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