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
numTypes
parameter in a call toStandardGetFile
orCustomGetFile
.
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.
typeList
parameter isn't empty (that is, that the value of thenumTypes
parameter 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 thetypeList
parameter 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 thetypeList
parameter.
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
numTypes
parameter to -1 when callingStandardGetFile
orCustomGetFile
.kUseOpenResourceTypes
in thenumTypes
parameter to have the file types read from your application's'open'
resource.
CONST kUseOpenResourceTypes = -2;WhennumTypes
is set tokUseOpenResourceTypes
,typeList
is set toNIL
, andfileFilter
is 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;TheStandardOpenDialog
function operates exactly like theStandardGetFile
function, whose parametersfileFilter
,numTypes
, andtypeList
are given the valuesNIL
,kUseOpenResourceTypes
, andNIL
, respectively.
- IMPORTANT
- The
StandardOpenDialog
function is implemented as glue code and is available in System 6 and later if you link your application with the appropriate object library.