Spread 8.0 Documentation
LeaveCell, ScriptLeaveCell Events
Support Options
ActiveX Reference > ActiveX Events > LeaveCell, ScriptLeaveCell Events

Glossary Item Box

LeaveCell, ScriptLeaveCell Events


See Also

Applies To

fpSpread control

Description

Occurs when the user moves the focus from one cell to another.

Syntax

C++

afx_msg void OnLeaveCellfpSpread(UINT, int, CWnd*, LPVOID);

Visual Basic

Sub fpSpread_LeaveCell(ByVal Col As Long, ByVal Row As Long, ByVal NewCol As Long, ByVal NewRow As Long, Cancel As Boolean)

Note: The ScriptLeaveCell event uses the same syntax except event parameters that are not passed "ByVal" are declared as variants. For more information on Script events, see Scripting Environment Usage.

Parameters

The following parameters are available:

Parameter Description
Col Column number of cell losing the focus
Row Row number of cell losing the focus
NewCol Column number of cell receiving the focus
NewRow Row number of cell receiving the focus
Cancel Set this value to True to prevent the focus from moving

Remarks

The LeaveCell event occurs before the active cell moves, letting you prevent certain actions.

If the focus is moved outside of the control, both the NewCol and NewRow parameters return –1.

Use the SheetSendingEvent property if you want to return the sheet for which this event occured.

Notes:
  • Setting the Cancel parameter to True does not prevent the focus from leaving the control. It only prevents the active cell from changing within the fpSpread control. For example, if you set the Cancel parameter to True for the event, and the MoveActiveOnFocus property is set to True, when the user moves the focus from the fpSpread control, the LeaveCell event occurs, but the focus leaves the control. When the focus returns to the fpSpread control, however, the active cell will be the same one it was before the fpSpread control lost the focus.
  • This event will occur if you use the fpSpread control in a scripting environment (for example, Microsoft's Visual InterDev or Internet Explorer) or a non-scripting environment. However, if you want to use the fpSpread control in a scripting environment and you want to change any parameter that is not passed "ByVal", you must set the ScriptEnhanced property to True and use the ScriptLeaveCell event. ScriptLeaveCell event parameters that are not passed "ByVal" are declared as variants.

See Also

ScriptEnhanced, SheetSendingEvent properties

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.