Using Triggers, Button Short Cuts, and System Actions

In this section:

Maintain's event-driven processing is based on triggers. Triggers are links between events and actions. An event is something that an end user does, such as pressing a function key; an action is something that the application executes, such as a function. (Functions are called cases by the Winform Painter.)

For example, you might define a trigger that links the PF7 key to the UpdateSalary function. At run time, each time an end user presses PF7, Maintain invokes UpdateSalary. In this case, you have defined pressing the PF7 key as the trigger event, and you have defined the UpdateSalary function as the trigger action. (Trigger actions are also known as event handlers.)

There are several kinds of triggers:

It is possible to assign the same key to several triggers and a system action. What would happen if an end user pressed that key? What action(s) would the key execute? That would be determined by the general order of precedence for resolving a key's assignments: control-level trigger, then form-level trigger or button shortcut, then system action. When an end user presses a function key, if:

  1. The cursor is on a control, and one of the control's triggers has been assigned to that key, that trigger's Maintain function is performed. (Maintain functions—usually simply called functions—are referred to in the Winform Painter as cases.)

    If a system action has also been assigned to that key, the system action is performed immediately following the trigger's function. (If the trigger function closes the Winform, the system action is not performed.)

  2. The cursor is not on a control—or it is on a control for which no trigger has been assigned to that key—but a form-level trigger or a button shortcut has been assigned to that key, the form-level trigger or button trigger's function is performed.

    If a system action has also been assigned to that key, the system action is performed immediately following the trigger's function. (If the trigger function closes the Winform, the system action is not performed.)

  3. No form-level triggers have been assigned to that key, and no control-level triggers for that key are in effect, but a system action has been assigned to that key, the system action is performed.

Top of page

x
Specifying Triggers

Selecting Triggers in the Form menu, or clicking the Triggers button or pressing PF12 when creating or editing a control (other than a button) displays the Triggers dialog box:

All of the function keys are displayed with their corresponding Maintain functions. (Maintain functions—often simply called functions—are referred to in the Winform Painter as cases.) You may change, add, or delete functions. When you are done, press PF4. Press PF3 to cancel the transaction.

For reference, you can also see the system actions assigned to each key.

To view the available functions, place the cursor in the shaded Trigger column, on the row of the desired PF key, and press PF5. This displays the Available Cases dialog box:

Select a function from the list and press PF4. This assigns the function to the PF key you specified in the Triggers dialog box. Use PF8 to scroll forwards and PF7 to scroll backwards in the Available Cases dialog box. Press PF3 to cancel the action and return to the Triggers dialog box.


Top of page

x
Specifying System Actions

Reference:

Selecting Actions in the Forms menu displays the System Actions dialog box:

All of the function keys are displayed with their corresponding system actions. Some system actions are assigned by default. You may change, add, or delete system actions. When you are done, press PF4. Press PF3 to cancel the transaction.

To view the available system actions, place the cursor in the shaded Action column, on the row of the desired PF key, and press PF5. This displays the Available Cases dialog box, which lists all system actions:

Select a system action from the list and press PF4. This assigns the system action to the PF key you specified in the Systems Actions dialog box. Use PF8 to scroll forward and PF7 to scroll backward in the Available Cases dialog box. Press PF3 if you want to close it and return to the Systems Actions dialog box without assigning a system action.



x
Reference: Available System Actions

You can assign the following system actions to system action keys:

System action

What it does

Close

Closes the currently active Winform and returns control to the function that opened it.

Accept

When the cursor is on a field for which Accept data validation information is available, displays a list of values from which the end user can select. For more information about making Accept data validation information available for a field, see Accepts.

Exit

Terminates the current Maintain procedure; if this procedure was called by another procedure, it returns control to the calling procedure.

Return

Is a synonym for the Close system action.

FieldLeft

When the cursor is on a field or grid cell in which the data is longer than the width of the field or cell, scrolls the data to the left.

FieldRight

When the cursor is on a field or grid cell in which the data is longer than the width of the field or cell, scrolls the data to the right.

Left

When the cursor is on a grid, scrolls the grid one column to the left.

Right

When the cursor is on a grid, scrolls the grid one column to the right.

Forward

When the cursor is on a grid, scrolls down the grid's columns the full height of the grid.

Backward

When the cursor is on a grid, scrolls up the grid's columns the full height of the grid.

OnTop

If other Winforms are displayed on top of the current Winform, moves the current Winform to the top of the pile.

Close_Winform

Is a synonym for the Close system action.



Example: Trigger and System Action Precedence

Imagine that, in a new application, you assign the UpdateEmployee function to the form-level PF5 trigger. At run time, if the end user presses PF5 while the cursor is on the Winform background, Maintain will invoke UpdateEmployee.

Imagine that you also assign the ValidateCheckBox function to a check box's PF5 trigger. Furthermore, you assign the Close action to the PF5 system action. At run time, if the end user presses PF5 while the cursor is on the:


Information Builders