Extending a script

When you extend an ancestor script for an event, PowerBuilder executes the ancestor script, then executes the script for the descendant when the event is triggered.

StepsTo extend an ancestor script:

  1. In the first drop-down list in the Script view, select the object or a control, and in the second drop-down list, select the event for which you want to extend the script.

  2. Make sure that Extend Ancestor Script on the Edit menu or the pop-up menu in the Script view is selected.

    Extending the ancestor script is the default.

  3. In the Script view, enter the appropriate statements.

    You can call the script for any event in any ancestor as well as call any user-defined functions that have been defined for the ancestor. For information about calling an ancestor script or function, see “Calling an ancestor script” and “Calling an ancestor function”.

Example of extending a script

If the ancestor script for the Clicked event in a button beeps when the user clicks the button without selecting an item in a list, you might extend the script in the descendant to display a message box in addition to beeping.