How to get DnD to work in GTKD?

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


On Saturday, 16 September 2017 at 17:08:52 UTC, Joseph wrote:
> On Saturday, 16 September 2017 at 14:33:53 UTC, Mike Wey wrote:
>> On 16-09-17 06:33, Joseph wrote:
>>> [...]
>>
>> 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.

Ok, so I dragged some text from the same app and it worked! Even 
though I set

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

So, seems to be a settings/setup issue.


More information about the Digitalmars-d-learn mailing list