trigger quit

Trigger that handles processing when a Quit request is received, usually with the intention of closing the component without saving any modifications made in it. This trigger is exposed as an operation in the component signature.

Declaration: trigger quit
Applies to: Form, Report, Service, Session Service, Entity Service
Activation: Activated by a Quit request, which can be invoked by the activate statement, or by the ^QUIT structure editor function in a form.
Default behavior: Sets return 0.
Behavior upon completion: If $status is 0, the component closes after agreement of other involved components, such as attached child or parent components. If all involved components agree on termination, they are closed without firing any additional triggers.

If $status is non-zero, the component does not agree on the Quit request. quit triggers of other involved components will not be fired; none of the involved components will be closed.

Important: Be aware of the values returned in $status, because it is easy to write components that you cannot exit.

Description

A Quit request is usually invoked to close the component without saving modifications made on it. In contrast, an Accept request is invoked to close the component but first save any modifications.

The quit trigger often contains ProcScript that verifies with the user whether it is required to store modifications and additionally perform a store. However, the quit trigger is also fired because of an Quit request on an attached parent component, such as tab form. In this case, the quit trigger should only contain ProcScript code that determines whether the component agrees to the Quit request or not.

If data is to be stored as part of quit trigger code, this should be handled in a separate operation that is activated from the quit trigger of the parent component. This ensures that no data is stored until all involved components have agreed to the Quit request.

Trigger Activation and Execution

A Quit request can be invoked by the structure editor function ^QUIT (forms only) or when the QUIT operation is activated. If the quit trigger successfully executes, the component agrees to the Quit request. If all involved components agree to the Quit request, the component is closed.

The quit trigger is always activated after being invoked by the structure editor function ^QUIT, even if implicit field-level syntax checking or data validation fails.

The quit trigger is executed when a Quit request is invoked on the current component, or on its attached parent component.

If the component has attached child components, all attached child components must agree to the Quit request by successfully executing their quit triggers. If the quit trigger fails on one of the child components, the Quit request is terminated. As a consequence, this trigger is not executed and no components are closed.

Related Topics