Drag and Drop from the finder

Howdy!

Been a Real Studio customer forever but never used it much at all.

Now I have a project I need to do and I have decided to pick up Xojo for it.

I am on OS X, and one of the functions I need is drag and drop from the finder

No matter what I do I cannot drag and drop a file from the finder into a ListBox or Canvas.

I was hoping that someone could put me on the right course.

Regards

Since I cannot edit my post I shall append it here and say that I have tried the DropObject method and it isn’t working.

Aaron, did you make a call to http://documentation.xojo.com/index.php/RectControl.AcceptFileDrop in your Open event handler?

Excellent!

Thanks.

What about a drop in the application’s Icon ?

A bit of informatio: http://documentation.xojo.com/index.php/Application.OpenDocument_event
Change the code to add the data to the ListBox.

Other things have to be done. Someone ?

in the open Event of a canvas
what is the difference between
me.AcceptPictureDrop
me.AcceptFileDrop(“image/jpeg”)

if i omit the later the dragdrop does not work, the image springs back to the finder window.
if i include the latter, drag and drop works.

David, you really should learn how to read the language reference.

http://documentation.xojo.com/index.php/Canvas

Each of these items are at the lower left corner of the grid where all events, properties and methods of Canvas are listed. Click on each and read the difference.

[quote=18573:@Emile Schwarz]What about a drop in the application’s icon?

A bit of information: http://documentation.xojo.com/index.php/Application.OpenDocument_event
Change the code to add the data to the ListBox.

Other things have to be done. Someone ?[/quote]

I think you also have to specify the FileTypes accepted by the app.
Make sure you have some File Type definitions in your project.
In the BuildSettings section of the project navigator, you see the OS-X option. Click it.
In the Inspector you find the button Choose right next to “File Types”.
There you can select which File Types will be accepted when dropped on the App’s file icon.
The OpenDocument event will deal with the file (or multiple files) dragged onto the App’s icon.

Right?

Drop onto the application icon is handled in app.OpenDocument when the app is not active, and by App’s HandleAppleEvent on Mac when the app is running. It has nothing to do with the topic.

The topic name is:
Drag and Drop from the Finder.

Drop onto the application icon in the Dock is also on topic (iMHO).

Please answer for the op interest.