Mastering PowerBuilder

HomePrevious Lesson: Course 3:: Session 25 :: Page 30
Next Lesson: Course 3:: Session 25 :: Page 50
Resource Files

A Resource is any object or file that is dynamically referenced, and any object that PowerBuilder does not automatically include in the executable file. For example, you are displaying your company logo in the "About" window. It will display when you run the application on your machine. PowerBuilder tries to find the resource files somewhere on the Windows search path. When the resource is in a directory specified in the Windows search path, PowerBuilder loads and displays the resource in the application. When you deploy the application, it will not display on the end-use machine, because, PowerBuilder doesn’t include these files as part of the executable automatically. You need to deploy these resources explicitly. Resources include:
Bitmaps (.BMP)
Compressed bitmaps (.RLE)
Icons (.ICO)
Cursors (.CUR)

As you are aware of, you can define an icon for each object in PowerBuilder. For example, you need to define the icon for the application object, by that, operating system displays that icon when the application is minimized or in the task bar. You may be indicating the current row in the DataWindow with a custom icon. You need to ask PowerBuilder to include all these resources as part of the executable.

There are two ways of distributing the resources along with the application. One way is to distribute each of these resources separately with your application. The alternative is include in the executable file by including in the PowerBuilder Resource File. If you decide the later method, you need to list all these resources in a text file and let the PowerBuilder know about this file by specifying in the "Resource File Name" prompt.

To create a resource file, press SHIFT + F6 from any painter in PowerBuilder. PowerBuilder invokes its own editor. You need to list all the resources one per line. For example:

c:\workdir\MyCompanyLogo.BMP
c:\workdir\product.ICO
c:\workdir\RowIndicator.ICO

Save this file with .PBR extension. PBR indicates PowerBuilder resource file. You need to check the following places for the resources:
Object icons (ex: application icon, window icon)
Drag icons
Bitmaps that are assigned to Picture Control
Bitmaps that are assigned to PictureButtons
Icons that are assigned as the row indicator in the DataWindow control
Bitmaps assigned as Toolbar Icons
Bitmaps that are assigned to PictureListView, DropDownPictureListView
Bitmaps that are assigned to the Tab Object

If you are using any built-in icons, you don’t have to list them in the resource files. These are called stock icons. Built-in icon names end with exclamatory mark.

You need to list the DataWindow Objects that are assigned dynamically in the scripts to the DataWindow Controls. The format to include the DataWindow object names is different from above. Say, you are assigning d_report12 DataWindow object in the script, the entry for this file in the resource file would be:

c:\workdir\class_lib.pbl(d_report12)

HomePrevious Lesson: Course 3:: Session 25 :: Page 30
Next Lesson: Course 3:: Session 25 :: Page 50