[Gtk-sharp-list] Weird behavior in CellRendererToggle ...

Daniel Kornhauser dkor@media.mit.edu
Thu, 16 Oct 2003 04:37:58 -0400 (EDT)


The following happened to me:

Invalid values of a CellRendererToggle of a TreeViewColumn are not catched
at compile time resulting in invisible CheckButtons in the intanced
column.

I was porting tree_store.c to gtk#.

In the tree_store.c a column is inserted with
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW
							    (treeview),
							    -1, "Alex",
							    renderer,
							    "active",
							    ALEX_COLUMN,
							    "visible",
							    VISIBLE_COLUMN,
							    "activatable",
							    WORLD_COLUMN,
                                                            NULL);


Where the enums ALEX_COLUMN = 1, VISISBLE_COLUMN = 6 and WORLD_COLUMN =7

wich I (stupidly ported as)

Column = new TreeViewColumn("Alex", rendererToggle,
					"active", Column.Alex,
					"visible", Column.Visible,
					"activatable", Column.World);

The result compiles find but the checkBoxes are invisible :-(



After thinking about what I was coding I wrote code that works kind of
better but is not perfect:

			column = new TreeViewColumn("Alex", rendererToggle,
					"active", Column.Alex);
			column.Visible = true;
			rendererToggle.Activatable = true;
			rendererToggle.Active = true;

This last statement worked the "best" but it seems stupid since I'm using
the active signal twice.

The check boxes are now visible. :-)

What is the right way of handling this ?

Can the TreeViewColumn constructor handle several arguments ?

You can get the unifinished and ugly code of GtkDemo at

http://web.media.mit.edu/~dkor/GtkDemo.tar.gz

to play arround.


					Daniel.