[10310] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: adding an additional pointer to a treeitem
daemon@ATHENA.MIT.EDU (Tero Pulkkinen)
Sat Nov 21 16:53:57 1998
To: gtk-list@redhat.com
From: Tero Pulkkinen <terop@students.cc.tut.fi>
Date: 21 Nov 1998 23:53:29 +0200
In-Reply-To: "Andre' Karwath"'s message of "Sat, 21 Nov 1998 22:33:23 +0100"
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com
"Andre' Karwath" <Andre.Karwath@informatik.tu-chemnitz.de> writes:
> I'm quite new to this list and to Gtk too and have a small problem.
>
> I've created a gtk_tree widget where I need to add tree item widgets at
> runtime. Together with the item structure I'd like to store an
> additional information (a string) for each tree item and need therefore
> an additional pointer. I know that I can add all widgets to a
> gtk_tree_item and that the default one is a label. Now, beside this
> label I would like to store this additional pointer.
see gtk_object_set_user_data() from gtkobject.h, it can be used to attach
extra information to objects.
> I know how to do this in C++ or other OO languages, but I have no
> simple idea how I can do this in C using Gtk. Could anyone please help
> me?
you can add data to the items with inheritance with gtk+ too, but it
does involve somewhat more writing and if thats the only thing you
want to do, gtk_object_set_user_data() is the best alternative. (or
gtk_object_set_data() -- whatever)
--
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null