Testing the application in PowerBuilder

Before you try your application in a client browser, you can test it in PowerBuilder by defining a main window that opens the child window.

StepsTo test your PowerBuilder window ActiveX application:

  1. In PowerBuilder, create a new window object whose type is main (the default).

  2. Write a script for the Open event that opens the child window:

    Open(w_child)
    
  3. For convenience, you can set appropriate window sizes in the Window painter:

  4. Run the test window by clicking the Run Window icon.

NoteDebugging in PowerBuilder To use the PowerBuilder debugger, you need to run an application instead of a single window. Define an Application object with a script that opens the main window. Then you can use the Run or Debug commands to test the application.

Organizing objects in PBLs

In the Web environment, file size is important. Clients are downloading your application each time they run it (unless it happens to be cached because they ran it recently).

Before you build your application, use the Library painter to organize the objects your application uses in PBLs, which are the sources for the PowerBuilder window ActiveX application’s PBDs. To minimize file size, include only objects the application uses. Remove any objects that are not needed. You must:

Using PowerBuilder resource (PBR) files

Several controls can use external files for images. These include PictureListBox, TreeView, Picture, and PictureButton controls, pointers, and bitmap objects in DataWindow objects. If your application uses external files for the images, it is unlikely that the client has the same images on the same system path.

Instead of finding some way to install the pictures on client machines, you can use one or more PowerBuilder resource (PBR) files so that the images are built into the PBDs. The resulting PBDs are larger but self-contained.

Because you are building a PBD, not an executable, you do not need to include DataWindow objects in the resource file. All PowerBuilder objects in the source PBL are included in the resulting PBD.

NoteImages and other resources on a network Instead of building the files into the PBD, you can put the files in a generally accessible network directory, but the path to the files must be identical to the path named in the PowerBuilder objects. In the Windows environment, this means each client must use the same drive letter to map the network drive (or you can specify the server name in the path).

StepsTo define a PBR file:

  1. Open the File Editor (Shift+F6) or some other text editor and create a new file with the extension PBR.

  2. List each image or other resource on its own line. List the path and file name exactly as they are shown in the object’s Properties view or script.

    NoteShortcut Look at the object’s Properties view and use Ctrl+C to copy the file name to the clipboard. Then paste it into the editor.

  3. Save the file.

If your application includes several PBLs, each with objects using their own resources, you should create a PBR file for each PBL. The PBR file lists file names for resources that are used in one PBL.

Building the PBDs

Build your dynamic libraries (PBDs) using the System Tree or the Project or Library painter. Do the following:

For instructions on defining a PBR file and building your dynamic libraries (PBDs), see the chapter on creating executables in the User’s Guide.