Page 1 of 1


PostPosted: Fri Sep 19, 2014 9:36 am
by w2m
I have 2 TDMDropTextTarget components on a form. One is used to drop text from Internet Explorer, the other is used to drop text from a TDMDropTextSource application which accepts a filename.

How can I detect if the drop is from explorer or TDMDropTextSource so I can toggle setting one of the DropTarget.Acceptor Controls to nil so the other one functions.

In other words I know I have to set one of the TDMDropTextTarget AcceptorControl to nil but how to do this so both components can be used.

I guess the alternative is to use one TDMDropTextTarget and handle the drop in OnDrop and determine if the Droptext starts with http or if the DropText is a filename and then handle appropriately.

Any suggestions would be appreciated.

Re: TDMDropTextTarget

PostPosted: Mon Sep 22, 2014 9:38 am
by DropMaster
Drag and drop registration with Windows is done by window handle. In DropMaster terms, that means there can only be one DropMaster target at a time with its AcceptorControl property pointing at a given window or windowed control. Drag and drop also knows nothing about the source of the data.

You'll need to distinguish between the inputs yourself. But if you set AcceptTextFormats to accept both dtfFiles and dtfURL (and maybe dtfText also) you should be able to distinguish easily between drags of files and URLs easily in your .OnDrop handler. Or you could just accept text and look at the content yourself and figure it out.

So, as you surmised, because of how drag and drop works, you have to do all the work in a single drop target component.

Hope this helps.