Language Reference Guide : Events : InsertRow Event
 
Share this page          
InsertRow Event
The InsertRow event is triggered for a table field when the user automatically appends a row to the bottom of the table field.
This event has the following syntax:
on insertrow [tablefieldname]
tablefieldname is optional if you specify this event in a field script for a table field.
The following attributes of the FrameExec class can be used in the InsertRow event block:
TriggerField
Specifies the table field for which the user selected the InsertRow operation
OriginatorField
Specifies the table field in the initial on insertrow statement
InputFocusField
Specifies that this is set to NULL during the InsertRow event because focus has not yet been set on the new row. (Use the table field's CurRow attribute to access the new field.)
Use the CurFrame system variable to access these attributes. For more information, see FrameExec Class.
Usage: The InsertRow event is defined for table fields only.
The InsertRow event inserts a new row into the table field before executing the event block. In addition, the newly created row becomes the current row in the table field. Any operations that you perform against the current row in the event block are performed against the new row.
For example, to fill in code default values for new rows, you might specify the following code:
on insertrow tblfield =
begin
   /*  The current row will be the newly inserted
    **  one
    */
    tblfield[].Columnfld = fill_in_default(...);
end
If you define both InsertRow and ChildEntry events on a table field, the InsertRow event is triggered first.
The InsertRow event is not triggered for Insert Row operations performed on nested table fields.
Note:  The InsertRow event is triggered only when a new row is created at the end of a table field (except when using a 4GL 2.0 style table field).
You can turn off the automatic append operation in the property sheet for the table field or in your 4GL code using the table field's CurOps attribute. For information about how to make these changes in your 4GL code, see the Programming Guide.
You can modify the table field's ControlButton code for detecting inserts from the ControlButton menu. For more information, see the Programming Guide.
More information:
InputFocusField Attribute
OriginatorField Attribute
TriggerField Attribute