FutureBasic Logo

<<    Index    >> FutureBasic

resources   statement



Syntax
resources [ "pathname"] [ , "ttttcccc" ]

Description
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.
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.
myRes1.rsrc
myRes2.rsrc

myRes1.rsrc contains:
_"PICT" ID 501   Name "One"
_"PICT" ID 502   Name "Two"
_"PICT" ID 32512 Name "Fred"

myRes2.rsrc contains:
_"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):

See also
call <resource>; button