How Do I Define Application Level Events? (Magic xpa 4.x)
In Magic xpa, you can define events to happen in any task. However, sometimes you will want an event that can be triggered from any task, or when no task is running. For example, you may have a messaging system that checks for messages every few minutes, or a global error handler that gives a message for any unhandled database errors, or a pop-up program that is set to a hot key, which runs on top of any current task.
These global events are always coded in the Main Program of the project.
-
Open the Main Program.
-
Click on the Logic tab (Ctrl+1).
-
Press F4 (Edit->Create Line) to add a line. Two new lines will appear. Go to the first line and select Event from the drop-down list.
-
Tab to the right. An Event dialog box will appear.
-
Choose the event type you want to use. In this example we are using a system event, which is a keystroke.
-
Zoom (F5, Edit->Zoom) from the Event field. This will bring up a Key Definition dialog box.
-
Press the keystrokes you want to use to trigger the event. In this case we used Alt+Z.
-
Now you have a global event that will be triggered when Alt+Z is pressed. All you have to do is add whatever logic you want to execute when the event is triggered.
Here, we added a call to “Zip Code Lookup” which would show a list of states and zip codes.
How Do I Define an Event Handler to Be Executed Only When the User is Parked on a Specific Control?