By Kyle Hammond
kyle [dot] hammond [at] snowmintcs [dot] com
Last updated 1999-11-20Contents |
Please note that this code is very nice if you're programming for Mac OS 7.x - 9.x. If you're doing programming for Mac OS X, there are much more modern solutions that Apple provides for you to use. This archive contains code that uses CustomGetFile to grab more than one file at a time. If you need to ask the user for multiple files at one time, this is a simple way to add that functionality to your project. The interface design came directly from Metrowerks Codewarrior's Add Multiple... command. However, I wrote all of the code...almost. The code is actually based on GetFolder.c which is an old (no longer available) sample from Apple's Developer Connection. This code can make use of my List Manager substitute, The A List, or Apple's List Manager. |
Add the file GetMultiple.c and the DLOG, DITL and dlgx resources in GetMultiple.rsrc to your project.
Calling the function is quite simple. The function prototype is:
long CustomGetMultiple( FSSpecPtr outFSSpecArray, long inMaxReturned, FileFilterUPP inFileFilterUPP, ModalFilterUPP inModalFilterUPP );
outFSSpecArray
inMaxReturned
outFSSpecArray
array).inFileFilterUPP
inModalFilterUPP
The returned value is equal to the number of valid FSSpecs in the outFSSpecArray
array. It will be zero if the user chose no files or clicked cancel.
CustomGetMultiple defaults to using The A List, but can use Apple's List Manager instead. There is a #define
at the top of GetMultiple.c that switches between the two. Set GETMULTIPLE_USE_ALIST
to any non-zero value to use The A List (this is the default setting). Set GETMULTIPLE_USE_ALIST
to zero in order to use Apple's List Manager.
The list of selected files does not draw the file icons. I know there is code floating around that I could use to do that, but I don't have the time or the inclination to do it myself. If somebody wants to do that and email it back to me, I'd be happy to include it.
Add keyboard support when using Apple's List Manager. It just seemed like a lot of busy work so I haven't done it yet. If somebody else does that, please send me the source and I'll include it in the file here.
Note: These things will probably never get done because I don't program for Mac OS 7.x - 9.x anymore.
Thanks to Apple DTS for supplying the very nice GetFolder.c (although it's not available for download anymore).
Thanks to Metrowerks Codewarrior for showing how the user interface for getting multiple files should be.
Go to my home page.
Send feedback to kyle [dot] hammond [at] snowmintcs [dot] com
Updated: 2009-06-16
Page URL: http://kyle.snowmintcs.com/GetMultiple.php
The views and opinions expressed in this page are strictly those of the page author.
The contents of this page have not been reviewed or approved by anyone else.