resources [ "pathname"] [ , "ttttcccc" ]
This is a non-executable statement that performs two main functions:
The resources statement is optional. If you don't include it in your program, FutureBasic builds an application file of type "APPL", with creator signature "xxxx", containing a standard set of resources.
- It specifies your program's file type and creator;
- It identifies an existing file ("pathname") containing resources that should be copied into the resource fork of your application file or code resource file, when FutureBasic builds your file.
Resources may also be added by dragging a resource file into the project manager window.
You can include multiple resources statements in your program. FutureBasic uses the first encountered resources statement to determine the file type and creator.
The "pathname" parameter can be a full or partial pathname which specifies a file that contains resources; or which specifies an alias to such a file. If you use a partial pathname (for example, a simple file name), the path is assumed to be relative to your project folder. When FutureBasic builds your application file, it copies all the resources from the "pathname" file into the resource fork of the file that it builds. Note that if you don't specify the "pathname" parameter, you still must specify an (empty) pair of double-quotes.
Using multiple resources statements
It's sometimes convenient to have FutureBasic copy the resources from several different resource files. You can accomplish this by including multiple resources statements in your program, each specifying a different "pathname" parameter. If your program includes multiple resources statements, the second and all subsequent resources statements should not specify any parameter other than "pathname".
If your program includes multiple resources statements, there is the possibility of a "collision" between resources. This happens when a resource in one "pathname" file has the same type and same ID number as a resource in another "pathname" file. When this happens, the resource that was encountered later replaces the resource that was encountered earlier, when FutureBasic builds your file. You should keep this in mind when deciding in what order to place your resources statements.
New feature in Release 3: If your resource has an ID of 32512-32767, the compiler will renumber it when it sees the conflict. That way, you can refer to it by name and pick it up with GetNamedResource. This is important for those that want to distribute source code with required resources.
Example You have two resource files in your project.
_"PICT" ID 501 Name "One"
_"PICT" ID 502 Name "Two"
_"PICT" ID 32512 Name "Fred"
_"PICT" ID 501 Name "OneOne"
_"PICT" ID 502 Name "TwoTwo"
_"PICT" ID 32512 Name "Barney"
Your final application will contain:
_"PICT" ID 501 Name "OneOne" <- Note that OneOne replaced One
_"PICT" ID 502 Name "TwoTwo" <- Note that TwoTwo replaced Two
_"PICT" ID 32512 Name "Fred" <- First version of 32512 saved
_"PICT" ID 32513 Name "Barney" <- Second version of 32512 renumbered
Some useful resources
When building an application, FutureBasic automatically includes a standard set of resources that applications require. You can enhance your application by also including resources like the following (all of which can be created using ResEdit):
vers" resources with ID's 1 and 2 contain version information which is visible in Finder windows and in the "Get Info" window.
SIZE -- "
SIZE" resources with ID's -1, 0 and 1 contain important information about your application's memory size, what kinds of events it can respond to, and more. FutureBasic always includes a "
SIZE" resource whenever it builds an application, but you may want to override the features in the default "
SIZE" resource by providing one of your own.
ICN# -- Use these resources to assign special icons to your application and to the documents that your application creates. These resources also determine what kinds of documents can be dragged to you application's icon in the Finder.
call <resource>; button