Re: Setting a Tree View Cell to insensitive and uneditable





Is it possible to set a cell in a specific column and row to insensitive
and uneditable and not affect the rest of the cells in the same column?


Yes, you should change your TreeModel to have two additional boolean columns
to map the "sensitive" and "editable" boolean field for your TreeViewColumn,
something like (let's get the simple case of a single editable text field):


mymodel = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN);

gtk_list_store_set(mymodel, &it, 0, "Editable Cell", 1, TRUE, 2, TRUE, -1);
gtk_list_store_set(mymodel, &it, 0, "Not editable Cell", 1, TRUE, 2, FALSE,
-1);
gtk_list_store_set(mymodel, &it, 0, "Insensitive Cell", 1, FALSE, 2, FALSE
/*may be also true*/, -1);

gtk_tree_view_insert_column_with_attributes(mytreeview, -1,
                        "My column title", r, "markup", 0, "sensitive", 1,
"editable", 2,
                        NULL);

I've written not the full code but just the lines that should differ from
your actual implementation :)

-- 
Bye,
 Gabry



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