Re: [gtk-list] Re: data from tree



> selection->data should contain a widget, the tree item, as I
> understand it.  Not the text.  Before inserting the tree item I did
> something like:
> 
>     item = gtk_tree_item_new_with_label (name);
>     gtk_widget_show (item);
>     gtk_object_set_user_data (GTK_OBJECT (item), foo_data);
>     gtk_tree_append (tree, item);
> 
> foo_data is now associated with the tree item, and can be extracted
> with gtk_object_get_user_data (GTK_OBJECT (item));
> 
>  JS> I tried *_get_user_data in callback function but it also doesn't work :-(.
>  JS> Do you have any idea what to do?
> 
> No...this worked for me...unless it's the label text you want to
> extract and not user_data associated with the tree item.

Now I understand what was the problem. You get data associated with tree
items and I am trying to get item label. I believe that getting user data
works, but why have twice the same in the tree? I can save as user data
the same as in labels but I don't thing this is the best.

> I don't know how to do that directly in the tree widget.  In ctree you
> would call gtk_ctree_get_text (ctree, node, column, &text).

I will use ctree as soon as I compile gtk 1.1. But it still resist all my
afford...:-)

					Jen~a



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