To set up handling of the events generated during user work with data entry forms, use event handler.
An event handler is a unit created in the Fore language. An event handler enables the user to set actions when particular event occur extending functionality of data entry forms.
After links between forms or form elements are set up, if required, follow the step:
To connect an event handler, select the Set Handler item of the drop-down menu of the Handler button on the toolbar. The Set Handler dialog box opens:
Set:
Unit. Select the unit in the drop-down list with repository objects or start typing unit name in the search string. One unit can be selected.
Class. Select a class, which contains an event handler, in the drop-down list. One class can be selected. The list becomes available after the unit is selected, if it has the described class inherited from the ReportEvents class that contains implementation of methods for handling data entry form events.
Event handler class can have the constructor called at each class initialization. The designer must not contain parameters. If the class has several constructors without parameters, the first constructor is called that is located above the others in the code.
NOTE. Event class is initialized each time an action is executed in the data entry form. In this case wither one event or a chain of events can be generated.
Finish the selection by clicking the Apply button. The button becomes available after the class is selected.
To undo the event handler use, select the Reset item of the Handler button on the toolbar.
To execute the example create a unit. Add links to the Drawing, Express, Report, and Tab system assemblies.
Class EventsClass: ReportEvents
Public Sub OnAfterRecalcSheet(Sheet: IPrxSheet);
Var
Tab: ITabSheet;
Range: ITabRange;
Style: ITabCellStyle;
Begin
// Get data entry form sheet table
Tab := Sheet As ITabSheet;
// Select cell range for drawing
Range := Tab.Cells(0, 0, 10, 5);
// Set formatting style for selected range
Style := Range.Style;
// Set green color as cell background color for selected cell range
Style.BackgroundBrush := New GxSolidBrush.Create(GxColor.FromName("Green"));
End Sub OnAfterRecalcSheet(Sheet: IPrxSheet);
End Class EventsClass;
As a result, when the event occurs that follows data entry form sheet calculation, background of the A0:F10 cell range is filled with green color.
See also:
Building Data Entry Form | Working with Ready Data Entry Form