Saving a user object

When you save an object, you must give it a name.

Naming conventions

You should adopt naming conventions to make it easy to understand a user object's type and purpose. A user object name can be any valid PowerBuilder identifier of up to 40 characters. For information about valid identifiers, see “identifier names” in the online Help.

One convention you could follow is the use of u_ as the prefix for visual user objects and n_ as the prefix for class (nonvisual) user objects. For standard classes, include in the name the standard prefix for the object or control from which the class inherits. For external user objects, include ex_ in the name, and for custom class user objects, include cst_ in the name.

Table 14-3 shows some examples of this convention.

Table 14-3: Suggested naming conventions for user objects

Type of user object

Format

Example

Standard visual

u_control_purpose

u_cb_close, a CommandButton that closes a window

Custom visual

u_purpose

u_toolbar, a toolbar

External visual

u_ex_purpose

u_ex_sound, outputs sound

Standard class

n_systemobject_purpose

n_trans_test, derived from the Transaction object and used for testing

Custom class

n_cst_purpose

n_cst_commission, calculates commissions

StepsTo save a user object:

  1. In the User Object painter, select File>Save from the menu bar or click the Save button in the painter bar.

    If you have previously saved the user object, PocketBuilder saves the new version in the same library and returns you to the User Object painter.

    If you have not previously saved the user object, PocketBuilder displays the Save User Object dialog box.

  2. Enter a name in the User Objects box.

    To determine a useful name for the user object, see “Naming conventions”.

  3. Enter comments to describe the user object.

    These display in the Select User Object dialog box and in the Library painter, and document the purpose of the user object.

  4. Specify the library in which to save the user object.

    To make a user object available to all applications, save it in a common library and include the library in the library search path for each application.

  5. Click OK to save the user object.