Important: The information in this document is obsolete and should not be used for new development.
Introduction to Resources
A resource is data of any kind stored in a defined format in a file's resource fork. The Resource Manager keeps track of resources in memory and allows your application to read or write resources.Resources are a basic element of every Macintosh application. Resources typically include data that describes menus, windows, controls, dialog boxes, sounds, fonts, and icons. Because such resources are separate from the application's code, you can easily create and manage resources for menu titles, dialog boxes, and other parts of your application without recompiling. Resources also simplify the process of translating interface elements containing text into other languages.
Applications and system software interpret the data for a resource according to its resource type. You usually create resources using a resource compiler or resource editor. This book shows resources in Rez format (Rez is a resource compiler provided with MPW). You can also use other resource tools, such as ResEdit, to create the resources for your application.
Inside Macintosh: Macintosh Toolbox Essentials describes how other managers, such as the Menu Manager, Window Manager, Dialog Manager, and Control Manager, use the Resource Manager to read resources for you. For example, you can use the Menu Manager, Window Manager, Dialog Manager, and Control Manager to read descriptions of your application's menus, windows, dialog boxes, and controls from resources. These managers all interpret a resource's data appropriately once it is read into memory. Although you'll typically use these managers to read resources for you, you can also use the Resource Manager directly to read and write resources.
Subtopics
- The Data Fork and the Resource Fork
- Resource Types and Resource IDs
- The Resource Map
- Search Path for Resources