Re: Gtk_CTree : Help please

On Thu, 3 Aug 2000, Florent. Devin wrote:


> Hi,
> I was using gtk_tree to figure a tree structure from a program.
> In this tree, I set for each item a key (with this key I had access to
> the
> program and something).
> 	gtk_object_set_data (GTK_OBJECT (item), "key", key);
> And also for each kind of item I set a drop destination and drag
> source.		
> When I want to do the same thing with a Gnome MDI environnement, Havoc
> says
> that I have to use Gtk_CTree because Gtk_Tree was obsolete/deprecated.
> So I change my tree to a ctree one. Now it work fine but :
> How can I set a key for an item in a gtk_ctree ?
> I can't use gtk_object_set_data (GTK_OBJECT (item),...) because Gtk
> can't
> convert a GtkCTreeNode to an GtkObject (the GtkCTreeNode is opaque...).
> And a second question which is the same thing I think.
> How can I set a drag source and a dest drop for a specific item ?
> I've got this warning when I run my program.
> Gtk-WARNING **: invalid cast from `(unknown)' to `GtkObject'
> Gtk-CRITICAL **: file gtkobject.c: line 1034 (gtk_object_set_data):
> assertion `GTK_IS_OBJECT (object)' failed.
> This warning is done by this code :
> 	noeud = gtk_ctree_insert_node (GTK_CTREE (root_tree), tree, NULL,
> 		texte, 8,
> 		image->pixmap, image->mask,
> 		image->pixmap, image->mask,
> 	gtk_object_set_data (GTK_OBJECT (noeud), "nom", key);

  It looks like node is not an ancestor of GtkObject. What I would do, is to 

 And then use the following:


 instead of gtk_object_set_data().
 The hash will be destoyed automatically when the node dies.
 Or you can try to represent all data you wish to associate with a node via a
single pointer and use gtk_ctree_node_{s,g}et_row_data()
> -- 
> Florent DEVIN
> _______________________________________________
> gtk-list mailing list

 Best regards,

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