gtk_cell_renderer_toggle_new()
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. The program reads data from an xml file and displays it in a treeview. Each node has a flag called "Disable". As the xml gets read a new record gets prepended to the treeview for each node and the toggle should get set depending on the value of "Disable". All the other fields get the correct data. However, all of the toggles get set to the value of the last value of "Disable". Similarly, when one of the toggles get clicked, it seems to work until the mouse moves accross the treeview. Then all the toggles change to the last value of the last toggle clicked. Does anyone know why this happens and how to fix it? Thanks in advance, --dhk ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
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/ ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list