Parent pronoun

Description

Parent in a PowerBuilder script refers to the object that contains the current object.

Usage

You can use the pronoun Parent in scripts for:

Where you use Parent determines what it references:

Window controls When you use Parent in a script for a control (such as a CommandButton), Parent refers to the window that contains the control.

User object controls When you use Parent in a script for a control in a custom user object, Parent refers to the user object.

Menus When you use Parent in a menu script, Parent refers to the menu item on the level above the menu the script is for.

Examples

Window controls If you include this statement in the script for the Clicked event in a CommandButton within a window, clicking the button closes the window containing the button:

Close(Parent)

If you include this statement in the script for the CommandButton, clicking the button displays a horizontal scroll bar within the window (sets the HScrollBar property of the window to true):

Parent.HScrollBar = TRUE

User object controls If you include this statement in a script for the Clicked event for a CheckBox in a user object, clicking the check box hides the user object:

Parent.Hide( )

If you include this statement in the script for the CheckBox, clicking the check box disables the user object (sets the Enabled property of the user object to false):

Parent.Enabled = FALSE

Menus If you include this statement in the script for the Clicked event in the menu item Select All under the menu item Select, clicking Select All disables the menu item Select:

Parent.Disable( )

If you include this statement in the script for the Clicked event in the menu item Select All, clicking Select All checks the menu item Select:

Parent.Checked = TRUE