Top
PowerCOBOL V11.0 User's Guide
FUJITSU Software

5.3.5 Event Procedures for Controls in Arrays

When several controls are placed in an array, one event procedure is created for the array, not one for each control. (Even if an event procedure is meant to be used only on a single control, the event procedure is associated with the entire array.) Event procedures written for controls that are organized into an array can perform operations on all the controls in the array.

Unlike event procedures that are used for single controls, event procedures associated with arrays must include the USING clause in the LINKAGE section and the PROCEDURE DIVISION. The index for the control of the related event is described in the data control in the USING clause.

The control can be located within the array by referencing the data control with an index.

In the following example, four push button controls have been grouped together into an array named CmCommand2.

When any of the four separate buttons is selected by a user, a click event is generated for the entire array. The event procedure code in the example below will actually disable all four push buttons when any one of them is selected (clicked on).

Figure 5.12 A procedure processing array events