Event library EvntAttach() EvntDataAttach()
Programming guideline of WinDom

EvntAdd()

NAME

EvntAdd - add a function in a GEM event bind.

PROTOTYPAGE

int EvntAdd( WINDOW *win, int ev, void *proc, int mode);

PARAMETERS

win:
window targeted or NULL,

ev:
event to bind (see event list),

proc:
function address to add,

mode:

EV_TOP:
add the function in top position,

EV_BOT:
add the function in bottom position,

DESCRIPTION

This function allows you to bind sereval different functions to a same event. Note that EvntAttach() can only bind one function to an event. Functions can be inserted in top position - mode = EV_TOP - (it will call in first) or in bottom position - mode = EV_BOT - (it will call in last). In general way, a function is added in bottom position. The WM_DESTROY event is often an exeception. As the window should be destroy in last, additionnal function making reference to the window should be call in top position. For usage of other parameters see the EventAttach() manual.

EXAMPLES

Windows have a default WM_REDRAW function (WindClear()). So prefer EventAdd() to EventAttach():

         EvntAdd( win, WM_REDRAW, WinRedraw, EV_BOT);
Then, WindClear() will be firstly called then WinRedraw() will be called.

Windows have a default WM_DESTROY function (see WindCreate()) wich close, destroy the window and send an AP_TERM message if no more windows are in memory. A typical bind to WM_DESTROY is :

         EvntAdd( NULL, WM_DETROY, WinDestroy, EV_TOP);
     	/* and the Destroy function : */
     	void WinDestroy( WINDOW *win) {
     		/* Free up data attached to window
                but not destroy the window */
     	}
SEE ALSO

EvntAttach(), EvntDelete(), EvntExec(), EvntFind(), EvntWindom().