This content has been marked as final. Show 5 replies
Here's a basic 'file open' dialogue:
fileio = xtra("fileio").new()
selectedFile = fileio.displayOpen()
or for more advanced functionality, check out the 'GetFilename' function of the buddy api xtra: http://www.mods.com.au/budapi/
hope this helps!
Thank you. I guess I should be more specific. I am able to open a file and have done that in my past projects. What I want now is a scrollable window that displays all the files of a given extension in a given directory. I then use the cursor to double click on which file I want. Then the fileio commands come into play.
So...how do I create the scrollable window and that displays the files?
I will 2nd the notion that Duckets has told you already. Use BuddyAPI.
It has a command called baGetFileName that will do just what you are
I don't use fileIO, but I think that if you want to stay with it, the
setFilterMask() command is what you need to only show jpgs (or whatever
extension you want)
But seriously, Buddy is the easiest way to do this by far.
Hmm. Ok, thank you Mike and Duckets. I will check your recommendations out...
Or, if you really want to "roll your own" file selector, you can use the buddy API commands 'baFileList' and 'baFolderList' to get a list of the files and folders in a particular directory. You'd then want to put thes into a text field. Set the framing to 'scroll' in the property inspector, then add some lingo to detect which line is clicked on, and act upon it.
But yes - unless you want to do this in a special custom visual style, use buddyAPI - otherwise you're just re-inventing the wheel!