Drag n Drop hint move vs copy Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Drag n Drop hint move vs copy

Post by Widgets »

In trying to sort out my problem with some files not showing in the files list of wxFileDialog, I also was reminded of an old nuisance I had left unsolved.

When dragging a file into the utility, the drag hint, once it reaches my utility, claims I am 'move'ing a file, when I am only copying it.
In my code I followed the DND example from the wxWidgets book - the utility is one of my first efforts at working with wxWidgets - but I never did resolve the little annoyance of the 'move' where I expected and wanted 'copy'.

Any hints on what I am still missing?
TIA
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Drag n Drop hint move vs copy

Post by doublemax »

I don't know the example from the book, but usually you would override OnDragOver in the drop target and return "wxDragCopy".
http://docs.wxwidgets.org/trunk/classwx ... 7e82788652
Use the source, Luke!
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Drag n Drop hint move vs copy

Post by Widgets »

As far as I can tell, my code and the code in the book parallels that in the 3.0.1 DND example and in neither one can I see any override for the class DnDFile class for OnDragOver - only in the URL DnD case.
So I am still missing something :?
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Drag n Drop hint move vs copy

Post by doublemax »

the code in the book parallels that in the 3.0.1 DND example and in neither one can I see any override for the class DnDFile class for OnDragOver
In the DnD sample i only see "move" by default when dropping a file onto the file drop area. With the proposed override, i get "copy".
Use the source, Luke!
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Drag n Drop hint move vs copy

Post by Widgets »

In my case, for the DND sample, I do get the + in a small square as a graphic (no string other than the '+') when I drag a file name from the right hand pane.
If I drag a file (name) from a File Explorer window, I get the string 'move' along with the much larger graphic (two gears inside a frame) I also get while dragging within the File Explorer window and for my app

There seems to be a function to set the default action, but I have not found it used anywhere in the DND sample
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: Drag n Drop hint move vs copy

Post by Widgets »

Thank you, doublemax.
If I override the function and simply return 'wxDragCopy' unconditionally, I do get the 'Copy' string - but still get the much fancier graphic as well.
I had assumed I would have to do more than that ;-)
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Post Reply