Using global standard class user objects

Five of the standard class user object types are inherited from predefined global objects used in all PowerBuilder applications:

Replacing the built-in global object

If you want your standard class user object to replace the built-in global object, you tell PowerBuilder to use your user object instead of the built-in system object that it inherits from. You will probably use this technique if you have built a user object inheriting from the Error or Message object.

StepsTo replace the built-in global object with a standard class user object:

  1. Open the Application object.

  2. In the Properties view, click the Additional Properties button on the General tab page.

  3. In the Application properties dialog box, select the Variable Types tab.

  4. Specify the standard class user object you defined in the corresponding field and click OK.

    The sample shows the Variable Types tab of the Application properties dialog box

After you have specified your user object as the default global object, it replaces the built-in object and is created automatically when the application starts up. You do not create it (or destroy it) yourself.

The properties and functions defined in the user object are available anywhere in the application. Reference them using dot notation, just as you access those of other PowerBuilder objects such as windows.

Supplementing the built-in global object

You can use a user object inherited from one of these global objects by inserting one in your user object as described in “Using class user objects”. If you do, your user object is used in addition to the built-in global object variable. Typically you use this technique with user objects inherited from the Transaction object. You now have access to two Transaction objects: the built-in SQLCA and the one you defined.

For more information

For more information about using the Error object, see “Using the Error object”.

For information about using the Message object, and about creating your own Transaction object to support database remote procedure calls, see Application Techniques.

For more information about the DynamicDescriptionArea and DynamicStagingArea objects used in dynamic SQL, see the PowerScript Reference.