Re: GtkTreeView data



On Thu, 14 Apr 2005 18:23:11 +0100
Kris Marsh <moogman gmail com> wrote:

Hi,

I'm trying to attach extra information to each row in a list, and then 
retrieve it later on from a row on 
a double click (row_activated) event.
Basically, i've tried:

g_object_set_data(G_OBJECT(&iter_child), "my_info", 
GUINT_TO_POINTER(some_info));

Upon inserting an item into the list and then tried to retrieve it in
my callback, but it crashes on insert.

1) What should I be trying to link my extra data to? (I assumed the
iter that comes out from 
gtk_tree_store_append), but could be wrong.

2) How can I do this. Eventually the data is going to be either a char
array or a pointer to a structure

Maybe the easiest way to do it is to just add more fields when defining
the store, and put the data there. (gtk_list_store_new...)

You don't have to show it when linking the store to the view, so you can
have more fields than those visible. This saves the trouble of setting
the data with ..._set_data() and is easier to retrieve later on.

John



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