Any idea how to get an image dragged from the Photos app onto a RectControl to be accepted as a drag object?
You probably can’t, because if I recall correctly… Photos keeps them as specialized records in a propriatary database… you need to drag the actual source image (jpg, png etc)
You need to support promised file drags.
see
NSDraggingInfoMBS promisedFilesDroppedAtDestination if you use MBS Plugins.
@Sam Rowlands knows a whole lot about promised files too. They’re not easy in Xojo if I recall.
Or is it a lack in the documentation ?
I once had a large folder copied (some GBs) instead of getting the image in the target folder :(.
My advice is not to bother, you’re not meant to use it this way. It’s cumbersome, slow and frustrating for users and developers.
Instead in your application you present a media palette, which the user can then drag from and you’ll get actual files. Checkout the “Apple Media Library” code from my site http://ohanaware.com/xojo/
Or if you really really want to add support for all the customers who expect drag and drop (which is almost all of them as Drag & Drop was a function that Apple bought to the masses). You can also get that code from the same page, there’s also this thread I posted many moons ago about how to use the code.
https://forum.xojo.com/21742-promised-files-or-getting-files-from-apple-s-photos-app
Are you sure they still work, Sam?
I was (only) curious, so I downloaded them, but found no pictures showed up in the image browser, and dragged photos didn’t appear listed in the promised files example.
I’m on OSX 10.12.6 and used Xojo 2015 and 2017
Location my changed meanwhile.
[quote=380355:@Jeff Tullin]Are you sure they still work, Sam?
I was (only) curious, so I downloaded them, but found no pictures showed up in the image browser, and dragged photos didn’t appear listed in the promised files example.
I’m on OSX 10.12.6 and used Xojo 2015 and 2017[/quote]
There is something… I think it has to do when Photos is doing something with it’s library they’re not available. I had the same problem not too long ago and I don’t recall how I fixed it, but once it started working, it continued to do so.
The only other way is to use an Open dialog and tell your users to select their photos from “Photos” item in the left hand column.
In an ideal world, we’d create a “Photos” plugin so a user selects a bunch of photos in “Photos” and then clicks on your application’s icon within “Photos”.
However this can only be done in Xcode; and even then, it only allows for one image at a time and it still doesn’t give you the files, instead it gives you CGImages (so no RAW information, meta data…).