GenTrigger: 1 GenTrigger Overview

Up: GEOS SDK TechDocs | Up | Prev: GenTrigger | Next: 2 GenTrigger Usage

Whenever you need to allow the user to initiate a single action, you should probably use a GenTrigger. When activated, a GenTrigger simply sends a message to another object or process. Both the message and its destination can be set up in the GenTrigger's instance data. The trigger can also send data with the message. This is useful if several triggers send the same message (for example MSG_CHOOSE_COLOR) but send different data (for example "Blue," "Red," or "Green").

In some cases, the use of triggers is readily apparent (the "OK" button in a dialog box, for example, which will dismiss the dialog box) while at other times the use of triggers is not as obvious (as menu items, for example). The GenTrigger is a simple and widely used object, appearing in menus, dialog boxes, and primary windows--wherever you need a UI object whose sole action is to send out a message, a GenTrigger will probably suffice.

Because of the trigger's basic role, they cannot have children. Note that this does not mean that activating a trigger may not necessarily bring up an object indirectly (such as a dialog box), but only that an object may not be directly attached below a GenTrigger in a generic object tree.

Your application will choose the function of the trigger but it is left to the Specific UI to choose in what manner a trigger will be activated. (For example, under OSF/Motif, a GenTrigger may be built as a button and will be activated by clicking on the button.)

GenTriggerClass provides two instance fields. These instance fields are listed in GenTrigger Instance Fields .

Code Display 5-1 GenTrigger Instance Fields

/* GenTrigger inherits all the instance fields of GenClass. */
    @instance optr GTI_destination = 0;
    @instance Message GTI_actionMsg = 0;
@vardata void HINT_TRIGGER_BRINGS_UP_WINDOW;
@vardata void ATTR_GEN_TRIGGER_IMMEDIATE_ACTION;
@vardata void HINT_TRIGGER_DESTRUCTIVE_ACTION;
@vardata word ATTR_GEN_TRIGGER_ACTION_DATA;
@vardata word ATTR_GEN_TRIGGER_INTERACTION_COMMAND;
@vardata Message ATTR_GEN_TRIGGER_CUSTOM_DOUBLE_PRESS;
    /* Alias for messages with "void (word a, word b)" */
 typedef struct { word a, b; } TwoWordArgs;
@vardataAlias (ATTR_GEN_TRIGGER_ACTION_DATA)
		TwoWordArgs ATTR_GEN_TRIGGER_ACTION_TWO_WORDS;
    /* Alias for messages with "void (word a, word b, word c)" */
 typedef struct { word a, b, c; } ThreeWordArgs;
@vardataAlias (ATTR_GEN_TRIGGER_ACTION_DATA)
		ThreeWordArgs ATTR_GEN_TRIGGER_ACTION_THREE_WORDS;
    /* Alias for messages with "void (optr output, word a)" */

The GTI _actionMsg instance field sets the message for the trigger to send out upon activation. The activation itself is determined by the specific UI. The trigger will send this message to the output specified in the GTI_ destination instance field.

The GTI _destination instance field sets the object or process for the trigger to send its message to upon activation. The trigger will send the message in the GTI _actionMsg field to this optr. Often this will be a TravelOption or a GenTravelOption .


Up: GEOS SDK TechDocs | Up | Prev: GenTrigger | Next: 2 GenTrigger Usage