Drag and Drop onto app icon

I have a little program that I wrote in RS2011 for Windows which I now want to update for Mac OS X 10.10.

Part of this program is to accept drag and drop files or folders onto the icon then filter the files displaying the result in a listbox.

Although this approach works fine in Windows, it is not working on Mac OS X. I am finding that the filtered files that I pass to an array in the app class cannot be read by any other class or Window. The array is always empty unless I read it from the app class.

Is there another approach that I should be using and is it documented anywhere in the Xojo documentation?

It’s really hard to say what is going wrong without seeing your code. You have defined the filetype and can do the drop? How do you add your files to the array? This should just be a folder item array, correct? What are you doing then?

Filetypes are working as the drop works fine.

OpenDocument event in app class is this

[code] Dim i as integer

if Item.Directory = false then
If Right(Item.name,4)=".ttf" or Right(Item.name,4)=".otf" then
DropedFiles.Append Item

elseif Item.Directory = true then
For i = 1 to Item.Count
If Right(Item.item(i).name,4)=".ttf" or Right(Item.item(i).name,4)=".otf" then
DropedFiles.Append Item.item(i)


DropedFiles is an array of folder items in app class. If i test the contents of DropedFiles in here with

msgbox str(Ubound(DropedFiles)) it displays a positive number, but if I try to access DropedFiles from the main window it is always empty (-1).

Are you keeping it as a property in app so it doesn’t go out of scope in the main window?

Do you have a variable “DropedFiles” as a property of the window. When you are asking for ubound of DropedFiles, looking for the information about the app variable, you could be getting information about the window variable.


msgbox str(Ubound(app.DropedFiles))

@ Scott Griffiths Yes, it is a veritable in app and is not being moved elswhere.

@ Scott Siegrist No there is not another variable called DropedFiles, it only exists in the app class.

How is your window accessing DroppedFiles?

Through the Window ‘Open’ event.

I have been reading a few old posts here and I think it may have something to do with the unreliability of event processing order. The program maybe initialising the Window control before the app Open event has finished reading the dropped files. I’m not sure how to get around this.

You could add a timer to the window with a very low period value. In the timer’s action event, access the DropedFiles variable.

Excellent suggestion Scott, the Timer has grabbed the contents of the app.DropedFiles array.

Many thanks for your help.

Q: How is your window accessing DroppedFiles?
A: Through the Window ‘Open’ event.


What about DropObject ?

@Emile: For dragging on the app icon??? Nope.

Sorry: I was walking beside my shoes…