Using visual user objects

You use visual user objects by placing them in a window or in a custom visual user object. The techniques are similar whether you are working in the Window painter or the User Object painter.

StepsTo place a user object:

  1. Open the window or custom visual user object in which you want to place the visual user object.

  2. Click the User Object button in the PainterBar, or select Insert>Control from the menu bar and then select User Object.

  3. Select the user object you want to use and click the location where you want the user object to display.

    PocketBuilder creates a descendent user object that inherits its definition from the selected user object and places it in the window or user object.

What you can do

After you place a user object in a window or a custom visual user object, you can name it, size it, position it, write scripts for it, and do anything else you can do with a control.

When you place the user object in a window, PocketBuilder assigns it a unique name, just as it does when you place a control. The name is a concatenation of the default prefix for a user object control (initially, uo_) and a default suffix, which is a number that makes the name unique.

You should change the default suffix to a suffix that has meaning for the user object in your application.

For more information about naming, see “Naming controls”.

Writing scripts

When you place a user object in a window or a custom user object, you are actually creating a descendant of the user object. All scripts defined for the ancestor user object are inherited. You can choose to override or extend those scripts.

For more information, see “Using inherited scripts”.

You place a user object as a unit in a window (or another user object). You cannot write scripts for individual controls in a custom user object after placing it in a window or custom user object; you do that only when you are defining the user object itself.

Placing a user object during execution

You can add a user object to a window during execution using the PowerScript functions OpenUserObject and OpenUserObjectWithParm in a script. You can remove a user object from a window using the CloseUserObject function.