When EvntWindom() receives an GEM event. It looks for this event into an event list. There is one event list for the application and one event list for each window. When EvntWindom() finds the event among these event lists, it executes the function corresponding to the event in the list. So, to attribute a function to an event (ie to add an element in a event list), we use the function EvntAttach().
The application event list is empty by default but it is a good thing to handle the AP_TERM and the VA_START messages. A window is created with a default event list.
The function EvntAttach() allows you to add a handler in a list. The handler may deal with event messages or other GEM events such as MU_BUTTON, MU_TIMER, MU_M1 and MU_M2. See the EvntAttach() function for more details. Note that it is possible to target a specific window or the all application with the same event. For example the following call
EvntAttach( NULL, WM_XBUTTON, AppButton);tells EvntWindom() to call the AppButton() function when a MU_BUTTON event occurs. And the call
EvntAttach( win, WM_XBUTTON, WinButton);tells EvntWindom() to call the WinButton() function of the window win when a MU_BUTTON event occurs and the window win is active. The two calls:
EvntAttach( NULL, WM_XBUTTON, AppButton); EvntAttach( win, WM_XBUTTON, WinButton);are possible.
Others functions from the Event library allows you to control events lists. The function EvntDelete() removes an event form a given list, the function EvntFind() finds an event and the function EvntExec() executes the function attached to a given event.