(For OSX, MacOSLib, no plugins)
In my App, a user can either drop a single file, multiple files a directory or a combination of files/directories on a canvas. I’ll then handle things in code. (I have filetypes defined.)
However, instead of only drag and drop, I also want to give the option to do the same via an OpenDialog.
Either I’m missing something but as far as I can tell; In the Xojo OpenDialog, I can select multiple files but not directories. And if I select a directory and click the ‘Open’ button’, it goes ‘into’ the directory. It doesn’t return the directory. I would like it to be able to return whatever is selected. Either a directory or a file or multiple files/directories.
There are many Apps that allow this (VLC, iFlicks, Sublime, Preview etc.) but I can’t get it done via the Xojo OpenDialog.
(I’m aware of the SelectFolderDialog but that’s for Folders only. I would like to do both like many other Apps.)
Does anyone know some trick to get this done?
You need to use a NSOpenPanel, it has the option for selecting both files and folders. I know MBS has a NSSavePanel class (and I seem to recall NSOpenPanel is a subclass of NSSavePanel!).
[quote=206916:@Axel Schneider]This is an old Project with Carbon Declares
I do not remember where I found it.
It works in 2015R1 Cocoa App.
Maybe someone can convert for Cocoa[/quote]
It does work fine. Indeed it will need to be converted to Cocoa eventually.
It will also be necessary to have a 64 bit compatible set of declares soon.
Thank you.
[quote=207077:@Sam Rowlands]You need to use a NSOpenPanel, it has the option for selecting both files and folders. I know MBS has a NSSavePanel class (and I seem to recall NSOpenPanel is a subclass of NSSavePanel!).