Important: The information in this document is obsolete and should not be used for new development.
Declaring Custom Kind Strings
A file's kind string is the string displayed in the "Kind" column in a Finder window when a folder's contents are viewed by name, size, kind, label, or date (that is, by any method other than by icon or small icon). The Finder determines the kind string for a file by taking the name of the application that created it and, in the case of English, appending "document" to that name (for example "SurfWriter document"). If the user does not have the application that created the file, the kind string is simply "document".
If the application isn't available on the computer (the situation in which the user is most likely to want the kind information), the kind string is not particularly helpful. In that case, the displayed string is "document" (or some localization thereof), and the user has no idea which application created it. Moreover, the documents of applications that support many kinds of documents all have the same kind string, even though those documents may be of entirely different kinds (such as word-processing documents, spreadsheet documents, graphics documents, and so forth). It would be better to have the Finder list more information about a document than its creator.
- Note
- Localized versions of the Finder determine the kind string in other ways. For instance, the Finder may prepend some string (for example, "document de SurfWriter").
To solve these problems, Macintosh Easy Open allows you to define a custom kind string for each type of file your application creates. You do this by including a kind resource (a resource of type
'kind'
) in your application's resource file. The custom kind strings defined in a kind resource override the algorithm the Finder uses to create kind strings. Listing 7-3 shows a sample kind resource, in Rez input format.Listing 7-3 A sample resource of type
'kind'
/*sample kind resource for SurfSoft Works*/ resource 'kind' (1000) { 'WAVE', verUS, { ftApplicationName, "SurfSoft Works", 'SWTD', "SurfSoft Works text document", 'SWSS', "SurfSoft Works spreadsheet", 'SWDB', "SurfSoft Works database", } };A kind resource consists of an application signature, a localization code, and a list of file types and their corresponding kind strings. Each file type is associated with one kind string.To reduce the number of entries in a kind resource, you can declare your application's name by including an entry having the special file type
ftApplicationName
, as illustrated in Listing 7-3. Then, whenever Macintosh Easy Open encounters a document that belongs to your application but whose file type isn't listed in your application's kind resource, the Finder uses its standard algorithm to generate a kind string in the form "<application name> document".
The Finder uses only custom kind strings that have the same localization as the current system itself.
- Note
- Because a kind resource contains the application signature, an application's kind resource can be located in some file other than
the application's resource file. This feature allows translation extensions to provide kind strings for applications that might not be present on a particular computer. However, the kind resource in an application's resource file overrides any kind resource located elsewhere.