Link Search Menu Expand Document

SSpread.LeaveRow Event

Occurs before moving to another row with the OperationMode property $OperationModeRow (row mode).

※ The move is not complete when this event occurs. Use the AfterLeaveRow event when performing processing that is expected to be completed after the move is completed.

The following child objects are attached to the Event object.

Type Name Description
Number Row Row number before moving
Number RowWasLast $TRUE if the previous row is after the last row where the value is entered , otherwise $FALSE
Number RowChanged $TRUE if the row value changes, $FALSE otherwise
Number AllCellsHaveData $TRUE if all cells in the row are populated, $FALSE otherwise
Number NewRow Destination row number
Number NewRowIsLast $TRUE if the destination row is after the last row where the value is entered, $FALSE otherwise

The EnterRow event is fired at the beginning of the row edit state.

If move cells in the same row, the LeaveCell and AfterLeaveCell events will occur.

If move from the script, the event will not fire.

Example of usage

MaxCols = 5;
OperationMode = $OperationModeRow;
Function OnLeaveRow(e) {
    Col = -1;
    Row = e.Row;
    BackColor = $STD;
    Row = e.NewRow;
    if (e.NewRowIsLast == $TRUE) {
        BackColor = $FFCCCC;
    } else {
        BackColor = $CCCCFF;
    }
    if (e.RowChanged == $TRUE) {
        Col = 0;
        Row = e.Row;
        if (e.AllCellsHaveData == $TRUE) {
            FontBold = $TRUE;
        } else {
            FontBold = $FALSE;
        }
        Col = -1;
        Row = e.Row;
        if (e.RowWasLast == $TRUE) {
            ForeColor = $RED;
        } else {
            ForeColor = $BLUE;
        }
    }
}

Related Item

OperationMode property
AfterLeaveRow, EnterRow event