Event library EvntWindom() EvntAdd()
Programming guideline of WinDom

EvntAttach()

NAME

EvntAttach - bind a function to a GEM event.

PROTOTYPAGE

int EvntAttach( WINDOW *win, int ev, void *proc);

PARAMETERS

win:
window targeted or NULL,

ev:
event to bind (see event list),

proc:
function address to bind.

DESCRIPTION

This function links a function to a GEM event. A GEM event is a button event, keyboard event, ... but a message event too. An event can be applied to a window or to the application and sometime both. Possible events are:

WM_XTIMER:
timer event (MU_TIMER),

WM_XBUTTON:
button event (MU_BUTTON),

WM_XKEYBD:
keyboard event (MU_KEYBD),

WM_XM1:
MU_M1 event,

WM_XM2:
MU_M2 event,

others:
others values address the GEM messages (WM_REDRAW, etc)

An event can be attached to a window or more, to the application or both window and application. If an event is previously defined, a new call of EvntAttach() on this event removes the old event link.

A function binded to an event has the following prototype :

     	void function( WINDOW *win);
where win is the descriptor of the targeted window or NULL if the event addresses the application.

EXAMPLES

Define a global button event:

         EvntAttach( NULL, WM_XBUTTON, AppButton);
Define the button event of a window:

         EvntAttach( win, WM_XBUTTON, WinButton);
Define the window destroy event:

         EvntAttach( win, WM_DESTROY, WinDestroy);
Define a global event message (the application shutdown):

         EvntAttach( NULL, AP_TERM, ApTerm);
SEE ALSO

EvntAdd(), EvntDataAttach(), EvntDelete(), EvntExec(), EvntFind(), EvntWindom().