O'Reilly logo

REALBasic: TDG, 2nd Edition by Matt Neuburg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

File Types

As part of the Macintosh Finder interface, a file is typologically identified by two four-letter codes: its type and its creator. The creator code corresponds to the unique creator code of an application; the type code is a document type identifier. Generally speaking, this pair of codes expresses an “ownership” relation: this application “owns” this type of document. However, certain file types, such as 'TEXT' and 'PICT', represent standard public formats that any application can read and write, and others, such as 'pref' (a Preferences file), have no standard format, but identify the file’s purpose.

REALbasic operates with file types in two very different ways:

  • REALbasic can get or set the type and creator codes of a file pointed to by a FolderItem by means of the FolderItem’s MacType and MacCreator properties.

  • A REALbasic project can have associated with it certain special named file types; this association is established by way of the File Types dialog that appears when you choose Edit File Types.

Your project must have at least one named file type listed in the File Types dialog if you want your application to be able to put up an Open file dialog with GetOpenFolderItem, to be able to open files that are double-clicked in the Finder or dragged and dropped onto your application’s icon or into one of its windows, or to be able to create documents uniquely associated with itself.

The File Types dialog is shown in Figure 21-1. When you click the Add button, a further ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required