---------- Forwarded message ----------
From: Diego Jacobi <[EMAIL PROTECTED]>
Date: 03-abr-2008 12:53
Subject: Re: Setting tree view column attributes from its signal handler
To: Ian Puleston <[EMAIL PROTECTED]>
Maybe you have to call a refresh or repaint method on the entire treeview.
I understand that to be optimal and save cpu time, the treeview only redraws
the current and affected row, and not all the data in the screen as some
other toolkits does.
It seems like what you need is a spreadsheet or a grid. I am not sure if you
will be able to do it with the treeview.
A GtkTableView where each cell is processed separatedly of the column, like
in wxWidgets or the Borland Grid component will fit better this, but it
sadly doesnt exists in gtk yet.
Look at gtkextra.sourceforge.net, this proyect have a gtksheet widget, i
have not tested it but it could work for you.
Cheers.
2008/4/3, Ian Puleston <[EMAIL PROTECTED]>:
>
> Hi,
>
> Any ideas on this? I have a tree view that pops-up a menu when the user
> double-clicks in a cell. The menu has options both for the selected row
> and
> the selected column, but on this event the tree view highlights the
> selected
> row, so I wanted to try to highlight the selected column too. The
> following
> is what I tried to do in the tree view's "row-activated" signal handler:
>
> void treeViewClickHandler(GtkTreeView *treeView, GtkTreePath *rowPath,
> GtkTreeViewColumn *column, gpointer data)
> {
> GtkWidget *colsMenu = data;
> GtkCellRenderer *renderer;
> GList *cellList;
> int i;
>
> g_assert(GTK_IS_MENU(colsMenu));
>
> cellList = gtk_tree_view_column_get_cell_renderers(column);
> for (i = 0; (renderer = g_list_nth_data(cellList, i)) != NULL; i++)
> {
> g_object_set(G_OBJECT(renderer), "background", "blue", NULL);
> }
> g_list_free(cellList);
>
> gtk_menu_popup(GTK_MENU(colsMenu), NULL, NULL, NULL, NULL,
> 0, gtk_get_current_event_time());
> }
>
> This nearly worked, but the background color doesn't get rendered. It
> actually appears in the cells of the column as I subsequently move the
> mouse
> over them. So I tried adding this after the g_object_set to try to get the
> column's cells to render:
>
> gtk_cell_renderer_get_size(renderer, GTK_WIDGET(column),
> &cellArea,
> &xOff, &yOff, &width, &height);
> gtk_cell_renderer_render(renderer, GTK_WIDGET(column)->window,
> GTK_WIDGET(column),
> &cellArea, &cellArea, &cellArea,
> GTK_CELL_RENDERER_SELECTED);
>
> But that did nothing. I also tried removing the menu popup line and it
> still
> behaves the same, so it's not caused by displaying the menu. But I call
> similar code to change attributes of a column later in the signal handler
> for the menu, and that works fine.
>
> Can anyone see anything that I'm doing wrong here?
>
> Ian
>
>
> _______________________________________________
> gtk-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list