How to get DnD to work in GTKD?

Joseph via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 16 17:08:52 UTC 2017


On Saturday, 16 September 2017 at 14:33:53 UTC, Mike Wey wrote:
> 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.


Thanks, I added the code above but it didn't seem to get the 
handlers called. Is there anything else I'm suppose to be doing 
to initialize things or is it an issue with just getting the 
correct target setup?

if I drag a file I get the drag icon but no "output" from the 
callbacks. If I drag selected text from firefox to it, I get the 
not valid drag sign.


More information about the Digitalmars-d-learn mailing list