[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

Normally, after a commodity processes a hot key input event, it needs to
eliminate that input event.  Other commodities may need to replace an
input event with a different one.  The translate CxObject can be used for
these purposes.

    translateCxObj = CxObj  *CxTranslate(struct InputEvent *newinputevent);

The macro CxTranslate() creates a new translate CxObject.  CxTranslate()'s
only argument is a pointer to a chain of one or more InputEvent structures.

When a translate CxObject receives a CxMessage, it eliminates the
CxMessage and its corresponding input event from the system.  The
translator introduces a new input event, which Commodities Exchange copies
from the InputEvent structure passed to CxTranslate() (newinputevent from
the function prototype above), in place of the deleted input event.

A translator is normally attached to some kind of filtering CxObject.  If
it wasn't, it would translate all input events into the same exact input
event.  Like the sender CxObject, a translator does not divert CxMessages
down its personal list, so it doesn't serve any purpose to add any to it.

    void SetTranslate( CxObj *translator, struct InputEvent *ie );

It is possible to change the InputEvent structure that a translator looks
at when it creates and introduces new input events into the input stream.
The function SetTranslate() accepts a pointer to the new InputEvent
structure, which the translator will duplicate and introduce when it
receives a CxMessage.

HotKey utilizes a special kind of translator.  Instead of supplying a new
input event, HotKey passes a NULL to CxTranslate().  If a translator has a
NULL new input event pointer, it does not introduce a new input event, but
still eliminates any CxMessages and corresponding input events it receives.