Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 7 - Translation Manager / Using the Translation Manager


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 to StandardGetFile or CustomGetFile.

Note
For complete information about file filter functions, see the chapter "Standard File Package" in Inside Macintosh: Files.
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 typeList parameter isn't empty (that is, that the value of the numTypes 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 the typeList 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 the typeList parameter.

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 calling StandardGetFile or CustomGetFile.
When Macintosh Easy Open is present, you can pass the special value kUseOpenResourceTypes in the numTypes parameter to have the file types read from your application's 'open' resource.

CONST
   kUseOpenResourceTypes      = -2;
When numTypes is set to kUseOpenResourceTypes, typeList is set to NIL, and fileFilter is set to NIL, 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;
The StandardOpenDialog function operates exactly like the StandardGetFile function, whose parameters fileFilter, numTypes, and typeList are given the values NIL, kUseOpenResourceTypes, and NIL, 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.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996