Overriding a script

StepsTo override 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 override the script.

  2. Code a script for the event in the descendant.

    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”.

  3. Select Extend Ancestor Script on the Edit menu or the pop-up menu to clear the check mark.

    Clearing the Extend Ancestor Script item means that you are overriding the script.

At runtime, PowerBuilder executes the descendent script when the event is triggered. The ancestor script is not executed.

Example of overriding a script

If the script for the Open event in the ancestor window displays employee files and you want to display customer files in the descendent window, select Override Ancestor Script and create a new script for the Open event in the descendant to display customer files.