I have a window with two canvases that are drop targets. I have enabled AcceptFileDrop on both in their Open events and they work properly on Linux and macOS. However, on Windows, I instantly get the NOT symbol when I drag a folder or drive from the Desktop to the Parent Window.
Okay, maybe the parent is blocking, so I then added the AcceptFileDrop to the Window in its open event. Still no problem on Mac and Linux, but still failing with the NOT symbol on Windows.
I have made sure that the app is not running with elevated permissions.
Ideas, special sauce, stop supporting Windows?
Are you using the console remote debug stub on Windows? If I remember correctly, it works only when using the desktop version.
D&D works here correctly in a built app.
What type of stop sign are you seeing, a red one or a black one?
Red means there’s an issue with the file type (triple check spelling and extensions), black means there’s a elevation/ole issue.
Make sure to use a FileType to indicate to AcceptFileDrop what type of files you accept.
I’m using the special/disk and special/folder as defined in the File Type Set I’ve defined. I only want to accept folder/directories or volumes. Also, see my thread on the file type set error:
When creating a Filetype set and adding the special/disk and special/folder types from the choices provided, why does the editor give a warning stating that at least one extension must be provided?
I was on Windows 11 if that matters.
Can you replicate it on a brand new test project and upload it, I’m having issues reproducing it here, its working for me (it allows the drop), however it seems like it accepts anything.
From what I see, filetypes are meant for files with their extension, and not for folders. That is the reason why the filetype complains.
Perhaps you could use the mime type “special/any”, but then you will have to test the folderItem to see if it is a folder (untested).
Sub Opening() Handles Opening
I try again: Is it a problem in the built app or in the debug build only?
And if it‘s in debug build, are you using the console debug stub?
Hi Carsten, running on Windows in the Windows IDE.
Bingo! Mac and Linux accept the special/disk and special/folder, but Windows doesn’t.
And that’s what I was trying to fix. I’m now looking at the attribs on Windows to determine if it is a directory or disk.
I always use
and decide in the DropObject event if a file or folder is accepted.
This works on macOS and Windows.
If I use “special/any” instead of the four question marks I also see the blocking icon with the red sign.
In that case, you need to make sure that you have a FileType set and that special/any is defined in that set.
I’ve not checked it on macOS and Linux yet, but on Windows it works for me only if I use
me.AcceptFileDrop("????"). Then Drag & Drop works for every file and folder.
Xojo 2021r3.1, Windows 10 and 11