Constructor

Description

Occurs when the control or object is created, just before the Open event for the window that contains the control.

Event ID

Event ID

Objects

pbm_constructor

All objects


Arguments

None

Return Values

Long.

Return code choices (specify in a RETURN statement):

0 -- Continue processing

Usage

You can write a script for a control's Constructor event to affect the control's properties before the window is displayed.

When a window or user object opens, a Constructor event for each control in the window or user object occurs. The order of controls in a window's Control property (which is an array) determines the order in which Constructor events are triggered. If one of the controls in the window is a user object, the Constructor events of all the controls in the user object occur before the Constructor event for the next control in the window.

When you call OpenUserObject to add a user object to a window dynamically, its Constructor event and the Constructor events for all of its controls occur.

When you use the CREATE statement to instantiate a class (nonvisual) user object, its Constructor event occurs.

When a class user object variable has an Autoinstantiate setting of true, its Constructor event occurs when the variable comes into scope. Therefore, the Constructor event occurs for:

  • Global variables when the system starts up

  • Shared variables when the object with the shared variables is loaded

  • Instance variables when the object with the instance variables is created

  • Local variables when the function that declares them begins executing

Examples

This example retrieves data for the DataWindow dw_1 before its window is displayed:

dw_1.SetTransObject(SQLCA)
dw_1.Retrieve( )

See also

Destructor

Open