How to get DnD to work in GTKD?

Mike Wey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 16 14:33:53 UTC 2017


On 16-09-17 06:33, Joseph wrote:
> 
> 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.

You will also need to set an TargetList to tell gtk that you want to 
receive text:

```
TargetList lst = new TargetList([]);
lst.addTextTargets(0);

w..dragDestSetTargetList(lst);
```

for simple cases only `addOnDragDataReceived` will be needed, 
`addOnDragDataGet` is only used for the source and `addOnDragDrop` can 
be used to filter the things that can be droped.

List and Treeviews there are funtions like `getDragDestRow` available 
with the TreeView widget.

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list