How Do I Handle Events Raised in a Hosting Application Using a Handler Defined in a Component? (Magic xpa 4.x)
You can raise events in the host application, and have those events handled in the component. For instance, we could define an event to dial a phone number, and raise it in the host application when the user zooms on a phone number field.
There are three parts to this process. You need to:
- 
Define the event in the component
 - 
Handle the event in the component
 - 
Raise the event in the host
 
These three steps are defined below.

- 
Enter the event in the Main program of the component. Make sure that Expose is checked, and that it has a public name.
 - 
Choose the Event when you are creating the .eci.
 
Now, when you work with the component, you will be able to choose this event.

- 
Go to the host program, to where you want to raise the event.
 - 
Raise the event as you would any user event. The component event will show up in red, underneath the host’s own user events.
 

- 
Go to the component.
 - 
Go to the Main Program.
 - 
Create the event handler for your event. Set the Scope to Global.
 
Now this handler will execute when the host program raises the event.