I have a large app (“Lightwright”) that accepts dragging and dropping picture files on a canvas control. It’s been working great for 10+ years and has not been rewritten for API 2.0. Recently, I received bug reports from users saying that drag & drop isn’t working, and when I tried it on my laptop running macOS 14.4.1, it did not work.
I have a window with a canvas control on it, in the canvas’s .Open event, there is this bit of code to initialize it for drag & drop:
Me.AcceptPicture Drop
When a picture (.png, .jpg, etc.) is dropped on it, the control used to raise a .DropObject event, but it doesn’t raise anything at all.
Thoughts on how to get this working again? I’ve heard rumors that Apple has deprecated drag and drop, but that’s hard to imagine.
Also I can’t say if drag and drop is deprecated or not by Apple, but I’m using Xojo’s drag and drop just fine under Sonoma and earlier, as well as Windows 10/11.
Right now the only issue I’m having is the following:
I’m just using Me.AcceptPictureDrop. I use the AcceptFileDrop(“image/png”) in Lightwright, but AcceptPictureDrop has always worked fine for simple standard file types.
How do I post a copy of the test project (6kb zipped) to this conversation?
OK, that does work, though it’s very specific and the Xojo .PictureAvailable made it easy.
If I want to accept various kinds of files, how do I know what the actual filetype actually is when the file doesn’t have an extension? Most of the user’s picture files my users don’t end in .png or .jpg or .jpeg or .tiff unless they’re on Windows. Should I just try to open the file as various formats until I get one that opens it successfully?
If you’re unsure of a filetype, select your Filetypes in the IDE, and drag the file onto it, like below.
The first image is the file being dragged, the second shows new filetype created when it was dropped, with all the information you need.