Menus and Dialog Boxes: 5.4 Interaction Commands: Replacing Default Triggers

Up: GEOS SDK TechDocs | Up | Prev: 5.3 Standard Response Triggers | Next: 5.5 Triggers Completing Interactions

You may replace a trigger supplied by the Specific UI by adding your own custom GenTrigger (as a child of the GenInteraction) with its ATTR_GEN_TRIGGER_INTERACTION_COMMAND set to the proper InteractionCommand of the trigger to replace. You should also mark such triggers with HINT_SEEK_REPLY_BAR to place them within the reply bar, though this is not required. If there is no such hint, the trigger will appear within the body of the dialog.

You should set the trigger to perform whatever action your application requires (including the function of the trigger being replaced, if applicable). If necessary, the action handler should also perform the default handling of the replaced trigger. A moniker need not be supplied as the Specific UI will choose one based on the InteractionCommand and the context of the dialog. You may supply your own moniker.

In fact, in some cases you might want to merely change the default moniker of a standard response trigger without changing the functionality of the trigger itself. In this case, you should provide an override trigger with ATTR_GEN_TRIGGER_INTERACTION_COMMAND . You should then add your new visual moniker to this replacement but leave the action fields blank. The specific UI will assign any trigger set up with ATTR_GEN_TRIGGER_INTERACTION_COMMAND and a blank action to have the default behavior of the replaced trigger.

Code Display 7-24 Replacing a Standard Response Trigger

/* The GenInteractionType GIT_NOTIFICATION, when built as a dialog, automatically
 * contains a standard response trigger to send out the InteractionCommand IC_OK.
 * You can replace this trigger with one of your own by adding a trigger with that
 * InteractionCommand. Your trigger will override the system default. */
@object GenInteractionClass MyInteraction = {
    GII_type = GIT_NOTIFICATION;
    GII_visibility = GIV_DIALOG;
    GII_attrs = @default | GIA_NOT_USER_INITIATABLE | GIA_MODAL;
    GI_comp = MyGlyph, MyResponseTrigger;
}
@object GenGlyphClass MyGlyph = {
    GI_visMoniker = "New Mail has arrived";
}
/* MyResponseTrigger replaces the IC_OK default trigger for the Notification dialog
 * box. In this case, we will only change the visual moniker of the trigger. By
 * leaving the output fields blank, we cause the system to send
 * MSG_GEN_GUP_INTERACTION_COMMAND with IC_OK. (This is the default behavior.)
 * HINT_SEEK_REPLY_BAR is used to place this trigger within the reply bar of the
 * notification dialog. */
@object GenTriggerClass MyResponseTrigger = {
    GI_visMoniker = "OK, I acknowledge";
    ATTR_GEN_TRIGGER_INTERACTION_COMMAND = { IC_OK };
    HINT_SEEK_REPLY_BAR;
}

ATTR_GEN_TRIGGER_INTERACTION_COMMAND also performs a special function in dialogs displayed with UserDoDialog() . Whenever the user completes an Interaction in a UserDoDialog() dialog box by activating one of the response triggers, the InteractionCommand stored in the ATTR_GEN_TRIGGER_INTERACTION_COMMAND of the activated trigger will be returned. You can use this return value to determine which trigger the user activated. (See Thread Blocking Routines .)


Up: GEOS SDK TechDocs | Up | Prev: 5.3 Standard Response Triggers | Next: 5.5 Triggers Completing Interactions