In the hierarchy formed by ancestors and descendants, each descendant inherits its event scripts from its immediate ancestor. If an inherited event does not have a script, you can write a script for the event in the descendant. If the inherited event does have a script, the ancestor script will execute in the descendant unless you extend the script or override it. You can:
Extend the ancestor script—build a script that executes after the ancestor script
Override the ancestor script—build a script that executes instead of the ancestor script
You cannot delete or modify an ancestor script from within a descendant.
The Extend Ancestor Script item on the Edit menu or the pop-up menu in the Script view determines whether the script is extended or overridden. If the menu item is selected (a check mark displays next to it), the ancestor script is extended. If there is no check mark, the ancestor script is overridden.
When there is no script for the descendant, the Extend Ancestor Script menu item is selected and disabled. You cannot clear the menu item unless you add a script to the descendant. When you have added a script, the menu item is enabled and you can choose to override the ancestor script by clearing the menu item, or to extend it by leaving the menu item selected.
If you delete the script in the descendant If, after adding a script to the descendant and clearing the Extend Ancestor Script menu item, you delete the script, the menu item returns to its default state: selected and disabled. A message displays in the status bar warning you that this has occurred. If you then add a new script, the menu item is reenabled. You must remember to clear the Extend Ancestor Script menu item if you want to override the ancestor script.
To write a script that executes before the ancestor script, first override the ancestor script and then in the descendent script explicitly call the ancestor script at the appropriate place. For more information, see “Calling an ancestor script”.
To get the return value of an ancestor script, you can use the AncestorReturnValue variable. This variable is always available in descendent scripts that extend an ancestor script. It is also available if you override the ancestor script and use the CALL syntax to call the ancestor event script. For more information, see Application Techniques.