Was this helpful?
ChildExit Event
The ChildExit event is triggered for a composite field when one of its child fields receives an Exit event[event_Exit].
This event has the following syntax:
on childexit [compositefieldname]
compositefieldname is optional if you specify this event in a field script for a composite field, or if the composite field is the frame's top form.
The following attributes of the FrameExec class can be used in the ChildExit event block:
TriggerField
Specifies the field that is being exited
OriginatorField
Specifies the composite field specified in the initial on childexit statement
TargetField
Specifies the field to which the user plans to move the input focus next
InputFocusField
Specifies that this field is undefined at the beginning of the block; at completion this is the field to which the input focus moves.
In the ChildExit block, you can set the InputFocusField to move the input focus to that field after the ChildExit processing is complete.
Use the CurFrame system variable to access these attributes. For more information, see FrameExec Class.
Usage: The ChildExit event is defined for all composite fields, including the subform that is the frame's top form. If you specify this event in the frame script without a composite field name, the ChildExit event is triggered for the frame when an Exit event occurs on any field in the frame.
The ChildExit event block can be used to:
Detect if a row in a table field is being exited
You can validate the data in a row as a set, rather than as a series of individual validations.
The following example can detect when a row is exited in testtable, either with an intended destination to another row in the table field or to a field that is not in the table field:
on childexit testtable =
begin
    if field(testtable).WhichRow
            (cellfield = CurFrame.TriggerField) !=
             field(testtable).WhichRow
            (cellfield = CurFrame.TargetField) then
            /* Perform required validations on exited
            ** row
            */
    endif;
end
The WhichRow method in this code determines whether the field that users are moving to is in the same row as the field that they are leaving. If the row is different, the code performs the data validations on the row being exited. For more information, see the WhichRow Method.
To determine whether the user is leaving the row and the table field, use the IsAncestorOf method. For example:
ret_variable =
field(testtable).IsAncestorOf(descendant =
    CurFrame.TargetField)
For more information, see IsAncestorOf Method.
Add generic exit processing to every field on the form
You can provide a ChildExit event block for the frame as a whole. To do so, place the ChildExit event block in the frame script without specifying a composite field name in its syntax. OpenROAD then executes the event block when the user exits any field on the form.
For example, if you display a help message in help_field, when fields are entered, you can use ChildExit to make this message disappear on exiting any field:
on childexit =
begin
    help_field = '';
end
To specify exit processing for all fields on a subform, specify the name of the subform in the ChildExit event block syntax.
You can specify an Exit event block for a field and a ChildExit event block for one or more of the enclosing composite fields for the field. OpenROAD executes the Exit event block as described in Event Block Execution.
More information:
Last modified date: 12/20/2023