Events, Triggers, and Handlers (Magic xpa 4.x)
The event-driven architecture’s building blocks are events, triggers, and handlers. This section describes these elements.
The basic definitions of the building blocks are:
Event
|
An event is an abstract indication to the runtime engine that something has occurred within the running application. The runtime engine can either choose to ignore the event or respond to it. For example, a mouse click on a control issues an event in the runtime engine that a click has occurred. The runtime engine can then respond to this event accordingly.
|
Trigger
|
Every event is triggered when the application runs. Some events can be triggered as a response to an external activation, such as when a key is pressed or when the mouse is clicked. Other events can be triggered when a certain stage in the application is reached, such as an elapsed time period. This technical overview illustrates how events are defined in Magic xpa, and also shows that some events can be defined as triggers of other events.
|
Handler
|
A handler is a logic unit that runs when an event has occurred. A handler is defined to handle a specific event.
|
Magic xpa supports the following event types:
System
|
System events are triggered by keyboard actions. A System event is generally a key combination, such as pressing F5 or Ctrl+R.
|
Internal
|
Most Internal events are internal actions that the engine handles. For example, whenever a Next Line event is triggered, Magic xpa handles the event and performs the logic required to exit the current record and enter the next.
Some Internal events are triggered by interaction with the running application’s interface. For example, the Mouse Over event is triggered when the end-user moves the mouse over a form control.
|
The Runtime Keyboard Mapping file is used to assign key combinations that activate the internal actions. This actually sets System events as triggers for Internal events.
|
|
Timer
|
A Timer event is an event triggered at a defined time interval. For example, you can set a Timer event to be triggered every 10 minutes.
|
Expression
|
An Expression event is an event defined by a Magic xpa expression. The event is triggered whenever the defined expression is evaluated to a True value. Magic xpa evaluates the value of the expression in time intervals defined in the Keyboard idle seconds Environment setting.
|
Error
|
An Error event is triggered when a database-related error occurs at runtime. For example, a Duplicate index error is triggered when an attempt is made to enter a record with duplicate index values.
|
User
|
You can create your own events, called User events. User events let you create additional events and clearly describe their functionality.
|
ActiveX
|
An ActiveX event raised for COM objects.
|
The ActiveX event is no longer supported as of version 2.0.
|
|
.NET
|
You can select a .NET event by defining the .NET variable or a .NET class.
If the event handler is defined for a .NET variable, then the handler will be a specific handler for the selected variable.
If the event handler is defined for a .NET class, then the handler will be a general handler for this object for any instance of the object in the task or the runtime task tree.
|