[Gtk-sharp-list] Drag & Drop between two TreeViews

Yves Kurz ml_yves@magnific.ch
Mon, 20 Oct 2003 22:32:10 +0200


Hallo,

I'm learning to use gtk# and came to a point where I need help from
someone else.
To learn more about the TreeView widget I created an application which
locks pretty similar to gftp. Now I would like to be able to drag files
one TreeView to an other one. 
How is that done in gtk#. The only documentation I could find is the gtk
tutorial but it's not 1:1 portable from c to gtk#.

This is what I did.. It's not working. 
.
TargetEntry te = new TargetEntry ();
te.flags = (int)TargetFlags.Widget;
te.target = "STRING"; 
Gtk.Drag.SourceSet (treeView, Gdk.ModifierType.Button1Mask, te, 1,
Gdk.DragAction.Copy);
Gtk.Drag.DestSetTargetList (treeView, TargetList.New (te, 1));
treeView.DragDataGet += new DragDataGetHandler (ddgh);
treeView.DragDataReceived += new DragDataReceivedHandler (ddrh);
.
.

void ddgh (object sender, DragDataGetArgs args) {
	Console.WriteLine ("DragDataGet..");
	args.SelectionData.Text = "text";
}
void ddrh (object sender, DragDataReceivedArgs args){
	Console.WriteLine("DragDataReceived... info: "+
	args.Info+" X: "+args.X+" Y: "+args.Y+" selection Data: "+ 
	args.SelectionData.Data + " text: " +
	args.SelectionData.Text);
}



By running the program i get:
Gtk-WARNING **: can't set a target list on a widget until you've called
gtk_drag_dest_set() to make the widget into a drag destination

Then I made a grep trough the gtk# source files to find a class where
gtk_drag_dest_set is used but I haven't found anything.

Any help is highly welcome.. Thank you very much


yves