System Triggers
System triggers are script modules that are synchronously executed in response to system events initiated by commands.
Components, application shells, entities, and fields each have an associated set of system triggers.
Uniface provides default definitions for some system triggers of entities, fields, and components. For the most part, these implementations ensure that data can be correctly stored, retrieved, and displayed. In the case of web-based components, they also provide default state management and communication processing.
System triggers are fired as a result of system events that are triggered by commands such as read, delete, or validate. Such commands can cause a cascade of triggers to be fired, especially when validating data or writing to the database. For more information, see Trigger Activation.
Most triggers have no default behavior, so if a trigger event occurs but the associated trigger is not defined, no action is performed.
For a small number of triggers, if the trigger is not defined at a lower level, such as a field, Uniface searches for the trigger definition at the higher level, such as an entity. This provides a fallback mechanism for event handling. These triggers include the receiveMessage (components and application shells), userKey triggers (available for components and application shells), and error (available for fields and entities).
System Trigger Names
Object | System Triggers | Remarks |
---|---|---|
Application shells | apStart
preRequest postRequest receiveMessage quit |
Application shell triggers define actions that occur during the lifetime of the application. |
Components | accept
preActivate postActivate receiveMessage quit |
Component-level triggers define actions
that typically handle processing when the component is left in a positive or negative manner. Note: The exec operation, and accept and quit triggers are treated as public operations which are always declared as interfaces in a component signature. This ensures that both Uniface and other components can invoke these actions. |
Entities | delete
deleteUp error lock read preDeserialize postDeserialize preSerialize postSerialize validate validateKey write writeUp |
Entity-level triggers define actions affecting entity occurrences, such as adding, modifying, and removing them. |
Fields | error
formatToDbms formatFromDbms formatToDisplay formatFromDisplay validate
|
Field-level triggers define the actions to be taken at the field level. |
Headers, trailers, break frames | getFocus | Page formatting triggers define how forms and reports are printed. |
Headers, trailers, break frames Menus, Menu Options |
preDisplay option |
Use menu triggers to control the appearance of menu items before they are displayed and the action they perform when selected. |