Forum > Win32/64

Drag&Drop: equivalent for "OnDragOver" for DragOver from an external app?

(1/1)

d7_2_laz:
Using Windows 10 x64, Laz. 3.0 RC2.
For drag & drop between components (treeview, listview) inside the app i had the usual BeginDrag, DragOver .. etc. ..  DragDrop sequence. For each component it can be determined if a “DragAcceptFiles” or a Drag from which component as source will be accepted - and, at DragOver - for which subitem (e.g. which treenode, a drop will be accepted, which will be indicated visually by the cursor.
There's usually some logic behind - e.g. you shouldn't be able to drop a parent node (folder) beyond it's own childs.
That's well working.

For Drag & Drop done from outside the app (= from another app, here file manager) i'd foreseen e.g.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    Application.OnDropFiles := DirTreeOnDropFilesin which we can process e.g. dragging files & folders from outside into a treeview And here (within "DirTreeOnDropFiles") we can decide if a belonging operation should be done or not. Basically no problem.

Only: unfortunately during a drag, the visual indication by cursor (shows: accepted, or not accepted) will be still missing.
As the "DragOver" won't be entered/called here.

Upto now i didn't spend attention for this aspect, but i think it would be worthy.
So, in short: i'd wish to have some supplement for the "OnDropFiles" for to support an “DragOver”. For to control the acceptance behaviour and cursor.

Is that easy to achieve, or do one needs to engage a full OLE equipment for to achieve it,
as of the Wiki article https://wiki.freepascal.org/Drag_and_Drop_sample , chapter "Dragging from other applications"?

That said, i did a small test project (using a ShellTreeView only as demo).
It shows how the "Application.OnDropFiles" could be used for to introduce a drop,
and the OLE stuff only for to mimic the DragOver. The latter would make the app somehow more complicated.
But would such be the correct approach, or somebody knows an easier way?

Navigation

[0] Message Index

Go to full version