mertero
asked on
Drag & Drop / Copy & Move (Respond to control key presses...)
Hi Guys.
I have an app that does drag & Drop. It works great. It looks somewhat like the windows folder explorer. I can move files from folders to folders.
Now I want to add the capability to respond to the Control key to change the behavior from copy to move (i.e. with CONTROL it copes, without CONTROL it moves). Like in many applications.
It seems like quite a common thing to do, but I'm not sure how to do it.
In my app, I have OnStartDrag in the "files" listbox, and then I put the file's ID as the DragObject. The cursor is changed automatically to the "drag" cursor.
Pretty simple so far. But now I'm baffled on how to proceed... how can I intercept the press/depress on Control while draging? I guess I can do it on the dragged-to object (The folders list) only. And then somehow change the cursor and remember that the CONTROL is pressed?
Any advice before I start tackling this?
Ron.
I have an app that does drag & Drop. It works great. It looks somewhat like the windows folder explorer. I can move files from folders to folders.
Now I want to add the capability to respond to the Control key to change the behavior from copy to move (i.e. with CONTROL it copes, without CONTROL it moves). Like in many applications.
It seems like quite a common thing to do, but I'm not sure how to do it.
In my app, I have OnStartDrag in the "files" listbox, and then I put the file's ID as the DragObject. The cursor is changed automatically to the "drag" cursor.
Pretty simple so far. But now I'm baffled on how to proceed... how can I intercept the press/depress on Control while draging? I guess I can do it on the dragged-to object (The folders list) only. And then somehow change the cursor and remember that the CONTROL is pressed?
Any advice before I start tackling this?
Ron.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys.
I had to do some tweaking myself (Chagne the dragged OBJECT was the key) but you got me started in the right direction.
Cheers,
M.
I had to do some tweaking myself (Chagne the dragged OBJECT was the key) but you got me started in the right direction.
Cheers,
M.
https://www.experts-exchange.com/questions/20407731/load-save-ado-into-from-treeview.html#7873367
your needed part from there (in procedure SetTreeItemTypeSet):
....
//First do as want to Move
Result := [ddtMove];
//Get Shift Key
if (GetAsyncKeyState(VK_SHIFT
Result := Result + [ddtSort] - [ddtMove];
//Get Control Key
if (GetAsyncKeyState(VK_CONTR
Result := Result + [ddtCopy] - [ddtMove];
.....
hope you get it
meikl ;-)