Re: which number a GtkTreeViewColumn is in a GtkTreeView
- From: ginxd <ginxd btopenworld com>
- To: Razvan <razvaneduard xnet ro>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: which number a GtkTreeViewColumn is in a GtkTreeView
- Date: Fri, 29 Nov 2002 16:46:31 +0000
Razvan wrote:
I have a GtkListStore with 1 column. Data in this column are pointers
to a structure MyStruct.
Then, I have a GtkTreeView with 4 column. Text displayed in this
columns comes from MyStruct from the model.
So I use
gtk_tree_view_column_set_cell_data_func(column,renderer,someGtkTreeCellDataFunc_cb,NULL,NULL)
for each GtkTreeViewColumn.
but in
void someGtkTreeCellDataFunc_cb(GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell, GtkTreeModel *tree_model,GtkTreeIter
*iter,gpointer data)
I need to know the number of tree_column to know what member of
MyStruct to put there.
I have looked through the API but I didn't find anything.
If you have any sugestions I appreciate.
Might I suggest, you use some of the tips from the examples given. When
creating the column, set the information you need, e.g.:
g_object_set_data (G_OBJECT (renderer), "column", (gint *)col);
Where col is the number. You should then be able to use
g_object_get_data()... to get the information at any point.
Note: I think that there is a better way of sending the col, e.g.:
g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER(col));
and
gpointer p = g_object_get_data (G_OBJECT (renderer), "column");
col = GPOINTER_TO_INT(p);
Hope this helps.
Regards,
Martyn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]