How to get DnD to work in GTKD?

Joseph via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 16 04:33:27 UTC 2017


This is my code:

TargetEntry te = new TargetEntry("test", 
GtkTargetFlags.OTHER_APP, 0);


w.dragDestSet(GtkDestDefaults.ALL, [te], GdkDragAction.COPY);
w.addOnDragDataReceived((dragContext, x, y, selectionData, info, 
time, widget)
{
   writeln("ok1");
});

w.addOnDragDrop((dragContext, x, y, time, widget)
{
   writeln("ok2");
   return true;
});

w.addOnDragDataGet((dragContext, selectionData, info, time, 
widget)
{
   writeln("ok3");
});

I've used null in place of [te]. I'm not sure what target entry 
is for and if that is the problem or what. I am trying to drag 
files from windows explorer to a grid or label(I duplicated the 
code above for the label) and none the callbacks are ever called. 
I only need the filename of the file being dragged.

I will eventually also need to drag one list element to 
another(virtually so, I just need to know the index that was 
dragged).

Thanks.



More information about the Digitalmars-d-learn mailing list