Creating a PowerBuilder resource file

A PBR file is an ASCII text file in which you list resource names (such as BMP, CUR, ICO, and so on) and DataWindow objects. To create a PBR file, use a text editor. List the name of each resource, one resource on each line, then save the list as a file with the extension PBR. Here is a sample PBR file:

ct_graph.ico
document.ico
codes.ico
button.bmp
next1.bmp
prior1.bmp

StepsTo create and use a PowerBuilder resource file:

  1. Using a text editor, create a text file that lists all resource files referenced dynamically in your application (see below for information about creating the file).

    When creating a resource file for a dynamic library, list all resources used by the dynamic library, not just those assigned dynamically in a script.

  2. Specify the resource files in the Project painter. The executable file can have a resource file attached to it, as can each of the dynamic libraries.

    When PowerBuilder builds the project, it includes all resources specified in the PBR file in the executable file or dynamic library. You no longer have to distribute your dynamically assigned resources separately; they are in the application.

Naming resources

If the resource file is in the current directory, you can simply list the file, such as:

FROWN.BMP

If the resource file is in a different directory, include the path to the file, such as:

C:\BITMAPS\FROWN.BMP

NotePaths in PBR files and scripts must match exactly The file name specified in the PBR file must exactly match the way the resource is referenced in scripts.

If the reference in a script uses a path, you must specify the same path in the PBR file. If the resource file is not qualified with a path in the script, it must not be qualified in the PBR file.

For example, if the script reads:

p_logo.PictureName = "FROWN.BMP"

then the PBR file must read:

FROWN.BMP

If the PBR file says something like:

C:\MYAPP\FROWN.BMP

and the script does not specify the path, PowerBuilder cannot find the resource at runtime. That is because PowerBuilder does a simple string comparison at runtime. In the preceding example, when PowerBuilder executes the script, it looks for the object identified by the string FROWN.BMP in the executable file. It cannot find it, because the resource is identified in the executable file as C:\MYAPP\FROWN.BMP.

In this case, the picture does not display at runtime; the control is empty in the window.

Including DataWindows objects in a PBR file

To include a DataWindow object in the list, enter the name of the library (with extension PBL) followed by the DataWindow object name enclosed in parentheses. For example:

sales.pbl(d_emplist)

If the DataWindow library is not in the directory that is current when the executable is built, fully qualify the reference in the PBR file. For example:

c:\myapp\sales.pbl(d_emplist)