Re: Append to list store doesn't get all column attributes
- From: James <jamessteward optusnet com au>
- To: Florian Müllner <fmuellner gnome org>
- Cc: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Append to list store doesn't get all column attributes
- Date: Thu, 28 Jul 2011 15:56:46 +1000
On Thu, 2011-07-28 at 07:08 +0200, Florian MÃllner wrote:
Hey,
2011/7/28 James <jamessteward optusnet com au>
In a dialog with a scrolled window displaying a list, with one
column in
the view, where the cells are editable;
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW
(view),
-1,
"Name",
renderer,
"text", 0,
"editable", TRUE,
NULL);
This links the "text" (content) attribute of the tree view column to
the first column of the model, and the "editable" attribute to the
second one (TRUE == 1).
Well, that's embarrassing. It is so obvious when you point it out. Can
I claim tired eyes? ;-)
A button in the dialog allows the user to add to the list
with;
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, "New",
1, 0,
-1);
Here you add a row with ("New", 0) to the list - whatever the
intention of the second column, the tree view will use it to determine
whether the cell should be editable, and given that 0 == FALSE, it
won't be :-)
If you want all cells to be editable, the easiest way is to call
g_object_set (renderer, "editable", TRUE, NULL);
when setting up the tree view (assuming that you are using a
GtkCellRendererText). Of course, changing the gtk_list_store_set()
call to set the second column to TRUE would work as well ...
Yup, all fixed now. Thanks, Florian.
Regards,
James.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]