Important: The information in this document is obsolete and should not be used for new development.
Using File-Opening Dialog Boxes
Macintosh Easy Open works with the Standard File Package to list in the file-opening dialog box all files that your application can open, including those that it can open after they have been translated from their current format to some new format. In general, you don't need to rewrite your application (or even include any additional resources) to receive this service. Macintosh Easy Open provides it automatically when present in the operating environment.There are, however, some cases in which Macintosh Easy Open cannot provide this service and that might therefore require you to modify your application if you want to maximize compatibility with Macintosh Easy Open. In particular, if you use a file filter function when calling the Standard File Package routines as the only way of determining which files appear in the list of files to open, Macintosh Easy Open cannot safely add any files to that list. This is a problem only when you specify -1 as the value for the
numTypesparameter in a call toStandardGetFileorCustomGetFile.
If you use a file filter function when calling the Standard File Package, you should make sure that the list of file types you pass in the
- Note
- For complete information about file filter functions, see the chapter "Standard File Package" in Inside Macintosh: Files.
![]()
typeListparameter isn't empty (that is, that the value of thenumTypesparameter isn't 0). In that case, Macintosh Easy Open is able to expand the list of file types your application can open, regardless of whether you use a file filter function. Macintosh Easy Open inspects the file types passed in thetypeListparameter and adds to them all file types that can be translated into those file types. In short, you can use a file filter function and benefit from the translation services of Macintosh Easy Open if you specify a non-empty list of file types in thetypeListparameter.
When Macintosh Easy Open is present, you can pass the special value
- IMPORTANT
- If for some reason you want to prevent Macintosh Easy Open from expanding the list of file types your application can open, simply set the
numTypesparameter to -1 when callingStandardGetFileorCustomGetFile.![]()
kUseOpenResourceTypesin thenumTypesparameter to have the file types read from your application's'open'resource.
CONST kUseOpenResourceTypes = -2;WhennumTypesis set tokUseOpenResourceTypes,typeListis set toNIL, andfileFilteris set toNIL, the Standard File Package displays in the file-opening dialog box all files whose types are listed in your application's'open'resource (having resource ID 128) as well as all files whose types can be translated into those types.You can achieve this same result by calling the new Standard File Package function
StandardOpenDialog.
FUNCTION StandardOpenDialog (VAR reply: StandardFileReply): OSErr;TheStandardOpenDialogfunction operates exactly like theStandardGetFilefunction, whose parametersfileFilter,numTypes, andtypeListare given the valuesNIL,kUseOpenResourceTypes, andNIL, respectively.
- IMPORTANT
- The
StandardOpenDialogfunction is implemented as glue code and is available in System 6 and later if you link your application with the appropriate object library.![]()