[Mono-list] Simple Drag & Drop Questions

Andreas Sliwka as@5parts.de
Fri, 27 Aug 2004 08:25:43 +0200


Greetings,
  first I have to explain that after lurking on this list for nearly a
year the "developers notebook" persuaded me to actually code something
in c#. I must admit that it is very addicting. I haven't had that much
fun in hacking in weeks :-) Although monodevelop stops responding to
events after I click on certain links in the class documentation ...

  Now let me describe the tiny problem that I've got: I followed the
labs in the notebook and combined "drag & drop" and "building interfaces
with glade" from the GTK# sections. The following code snippet works, I
can drop file uris from nautilus on the filelist, but I get a strange
error (warning?) message.

Here my code (shortened):

use everything.needed.in.System.and.Glade.and.such;
public class MyProgram {
  public MyProgram (string [] args) {
    Program program = new Program ("MyProgram", "0.0", 
      Modules.UI, args);
    Glade.XML gxml = new Glade.XML (null, "gustav.glade", 
      "gustav", null);
    gxml.Autoconnect(this);
    Gtk.TreeView filelist = (Gtk.TreeView) gxml.GetWidget("filelist");
    Gtk.Drag.DestSet(filelist, DestDefaults.All, 
      filelist_drop_types,Gdk.DragAction.Copy);
    filelist.DragDataReceived += filelist_drop;
    program.Run();
  }

  private void filelist_drop(object o, DragDataReceivedArgs args) {
    bool success = false;
    // do some things
    success = true;
    Gtk.Drag.Finish (args.Context, success, false, args.Time);
  }
}	

... and I receive the following error message:

(MyProgram:5822): Gtk-WARNING **: You must override the default
'drag_data_received' handler on GtkTreeView when using models that don't
support the GtkTreeDragDest interface and enabling drag-and-drop. [...]

Why is that? Do I have to do funky things? I thought that I copied all
relevant parts from the examples ... 

System is Debian unstable with mono* 1.0.1-1. monodevelop is 0.5-2.

best regards,

mfg