\c{

Handlers

Handler objects provide a type secure way in which to deal with local data and global resources needed when responding to an event. A handler object may store the information it needs in instance variables, when its constructor is called. See slide class-handler. } .so sli-handler \c{ Activating a handler object in response to an event or a Tcl command occurs by calling the dispatch function of the handler. The system takes care of this, provided that the user has bound the handler object to a Tcl command or event. } .so sli-dispatch \c{ The dispatch function, in its turn, calls the operator() function, after storing the kit, argc and argv arguments in the corresponding instance variables. See slide dispatching. The handler::operator() function fetches the latest event from the kit object and selects one of the predefined member functions (press, motion, release, etc.) according to the type of the event. The original handler class knows only virtual functions. Each of these function, including the dispatch and operator() function, may be redefined. The two-step indirection, via the dispatch and operator() functions, is introduced to facilitate derivation by inheritance, directly from the handler or from classes that are themselves derived from the handler class, such as the widget classes. }