EvtHandler

Section: ET++ class description (n)
Updated: automatically Fri Mar 15 14:09:27 1991
Index Return to Main Contents
 

NAME

EvtHandler.short - event handler chain; controlling, commands, menus  

DESCRIPTION

EvtHandler is the abstract base class for all objects that handle events, perform commands and deal with popup menus. The class EvtHandler introduces the event handler chain concept (see also cookbook Event Handling).


Event Handler Chain


Event handlers are organized in a chain. The link between two handlers is the method GetNextHandler. Most of the methods defined by EvtHandler are implemented by forwarding the message to the next handler. Subclasses that override a method of EvtHandler should always call the inherited method in order to preserve the chain.
As an example, the VObject tree (see class VObject) of a window contains several event handler chains. Each chain starts at a leaf of the tree, follows the hierarchy upwards and either ends at the window or the window links it to another handler, usually a Document. Another example is the event handler chain View -> Document -> Application.
The event handler chain serves several purposes: Controlling, Command and Menu handling.


Controlling


Input events from the keyboard and the mouse are distributed from the root of a VObject tree to the leafs. The leafs can generate additional, application-specific events. Such events are forwarded along the event handler chain via the method Control. For example, things like buttons use Control to inform the "controlling" Dialog about a selection event (see method Button::DoOnItem, method ActionButton::Control and method Dialog::Control).
The counterpart of Control is the method SendDown (in older ET++ versions called DownControl). SendDown does not follow the event handler chain but allows a VObject to communicate with other objects that are lower in the VObject tree. By means of this method a VObject can request one or several objects down in the tree to do certain things or return some data. For example, the class OneOfCluster uses SendDown to switch one of its contained buttons on and all others off. The method DialogView::Control calls SendDown to assign the keyboard focus.


Commands (see also cookbook Commands)


The method VObject::DispatchEvents distributes mouse and keyboard events to the corresponding Do...Command methods. The command object returned by these methods is passed along the event handler chain through the method PerformCommand until the end of the chain is reached or an EvtHandler has overridden PerformCommand and executes the command. This is usually done by a Document (see the method Document::PerformCommand).


Menus (see also cookbook Menus)


Whenever the right mouse button is pressed over a VObject, then the a popup menu is shown. Four methods of EvtHandler deal with that menu: method GetMenu, method DoCreateMenu, method DoSetupMenu and method DoMenuCommand. By default, all methods are passed along the event handler chain so that several handlers may take part in the creation and setup of the menu as well as in the handling of menu commands. The method VObject::DoRightButtonDownCommand calls the menu handling methods in the following order:

        GetMenu         passed to the next handlers until one returns a menu
        DoCreateMenu            called once for new menus; allows to add menu items and submenus
        DoSetupMenu             enable/disable menu items and update their text
        DoMenuCommand   handle the menu command selected by the user


classes are always derived from EvtHandler.
class EvtHandler is never reused directly.
class EvtHandler is abstract.
class EvtHandler contains 12 methods.

owner of class:
nobody.
baseclasses:
Object
subclasses:
Application, Document, VObject
flags:
EvtFlags

 

INSTANCE METHOD LIST

commands
PerformCommand

constructor
EvtHandler

event handling
Control
DoIdleCommand
GetNextHandler
Send
SendDown

menus
DoCreateMenu
DoMenuCommand
DoSetupMenu
GetMenu

metaclass
FindNextHandlerOfClass

 

CATEGORIES

Application Framework

 

FILES

declaration:
EvtHandler.h

 

HISTORY

joe@csesbg.at  Thu Mar 28 16:25 MET 1991       1st version

joe@csesbg.at  Mon Jun 17 19:39 MET DST 1991   reworked

chris@csesbg.at        Tue Jun 18 20:30 MET DST 1991   reviewed

joe@csesbg.at  Wed Jun 19 16:51 MET DST 1991   last changes


 

Index

NAME
DESCRIPTION
INSTANCE METHOD LIST
CATEGORIES
FILES
HISTORY

This document was created by man2html, using the manual pages.
Time: 00:40:27 GMT, March 30, 2022