Event Level (Magic xpa 4.x)
The Event level is used to invoke a non-procedural event. It lets you assign a handler to an event, which can be created between a task and a record, or for a group (a Batch task) or control.
The Event level has the following properties:
|
|
Condition
|
Lets you enable or disable the event.
Yes means that the event is enabled.
No means that the event handler is disabled.
You can also define an expression that determines when the event handler is enabled.
|
Unit
|
Event
|
Event
|
Magic xpa displays an Event dialog box that lets you select an Event type and specific Event.
|
Control Name
|
You can select the control name. The control name can be edited. For example, you can select an Edit control named edit1 from the Control list for the handler and change the name to edit123. You can then apply the handler to another Edit control by naming it edit123. This is specifying a handler by name.
The advantages of specifying a handler by name includes:
-
Creating a control-specific handler before the control is created
-
Creating a handler for controls of the sane name in different GUI Class 0 forms
-
Maintaining the link between handler and control even if the control is recreated
Note: Magic xpa allows you to type in the control name before it is added to the task form.
See also:
How Do I Define an Event Handler to Be Executed Only When the User is Parked on a Specific Control?
How Do I Restrict the Handling of an Event to a Specific Control?
|
Directive
|
You can select how the engine should respond to the handled error event.
|
Message
|
You can specify whether Magic xpa displays DBMS messages for fatal or unexpected errors.
-
Yes – Displays DBMS messages. If this parameter is set to Yes, it overwrites the Display Full Messages setting (Settings/Environment/Preferences).
-
No – Does not display DBMS messages.
|
Scope
|
You can select one of the following:
-
Task – The handler is executed if the event is raised from the current task.
-
SubTree (default) – The handler is executed if the event is raised from the current task or any of its subtasks.
-
Global – The handler is executed if the event is raised from the current task, its subtasks or any other projects (host or components).This option appears in the Main Program.
Note: This property is not supported for .NET events raised by .NET objects not placed on the form.
See also:
How Do I Handle the Same Event Using Several Handlers?
How Do I Ensure that the Handling of an Event Will Only be Active in the Task Where It Was Declared?
How Do I Provide a Default Handler for My Entire Application?
|
Propagate
|
You can propagate an event to an event handler defined in a higher level. When Magic xpa regards the event as not handled, Magic xpa continues to search for an event handler at the next level. Event handlers are scanned from bottom to top in the runtime tree.
Yes means that Magic xpa searches for a higher level handler to handle the event. (If no handler is found, nothing will happen.) When Magic xpa regards the event as not handled, the dispatcher searches for an event handler at the next level.
No means that Magic xpa does not search for a higher level handler to handle the event.
You can also define an expression that determines when Magic xpa propagates the event handler.
Note:
-
System events that are mapped to internal events in the keyboard mapping file, will propagate to internal events. You can write a handler for either one of the events. For example, an Esc event (system) can propagate to an Exit event (internal).
-
Internal events cannot propagate to system events. This is because internal events are the last level that the engine handles and performs internal logic on it. For example, an Exit event (internal) cannot propagate to an Esc event (system).
-
When the Propagate property of the top user-defined Drag Begin/Drop event handler has been set to No, automatic handling of the drag/drop data cannot be performed.
-
This property is not supported for .NET events raised by .NET objects not placed on the form.
See also:
How Do I Utilize the Event Hierarchy?
How Do I Handle the Same Event Using Several Handlers?
How Do I Preserve Magic xpa Functionality for Internal Events Handled by User Handlers?
How Do I Disable Magic xpa Handling for Internal Events?
|
Execute On
|
Determines whether the entire handler will be executed on the server, or will be executed either on the server or on the client according to the runtime flow. This property appears in Rich Client and Web Client tasks, but is disabled for .NET events.
The options are:
-
Optimized (default)
-
Server
|
In runtime, the Magic xpa engine searches for the triggered event by searching for the matching control-specific handlers from the current task upwards along the runtime task tree. If the engine cannot locate a control-specific handler, it searches for non-specific handlers from the current task upwards along the runtime task tree.
Event Handling in Magic xpa
Handling the Same Event with More Than One Handler
Internal Events
Events and Handlers chapter in the Mastering Magic xpa guide