GrapeCity MultiRow Windows Forms Documentation
Retrieving the Method Used to Move Cells

In the GcMultiRow control, use the MoveStatus property to get the action used to move cells.

Target Events

The MoveStatus property can be used in the following events.

Values that can be Retrieved

Values that can be retrieved using the MoveStatus property are members of the MoveStatus enumeration.

If you use the SelectionActions action to move the current cell, the value corresponding to the action is retrieved. Also, if you use the mouse to move the current cell, the MoveStatus property retrieves MouseClick. If you move the current cell by some other operation, the MoveStatus property retrieves NoAction.

Values that can be Retrieved

Usage in the CellEnter, CellLeave, RowEnter, and RowLeave Events

You need to use the CellMoveEventArgs class in order to use MoveStatus in the CellEnter, CellLeave, RowEnter, and RowLeave events.

By default, the CellEnter and CellLeave events are defined in the CellEventArgs class, to ensure compatibility.

Using Code

The following code uses the CellEnter event.

[VB]

Imports GrapeCity.Win.MultiRow 
Private Sub GcMultiRow1_CellEnter(sender As Object, e As CellEventArgs) Handles GcMultiRow1.CellEnter 
Dim newArgs As CellMoveEventArgs = DirectCast(e, CellMoveEventArgs) 
If newArgs.MoveStatus = MoveStatus.MouseClick Then
Console.WriteLine(GcMultiRow1.CurrentCellPosition) 
End If 
End Sub

[CS]

using GrapeCity.Win.MultiRow; 
private void gcMultiRow1_CellEnter(object sender, CellEventArgs e) 
{ 
CellMoveEventArgs newArgs = e as CellMoveEventArgs; 
if (newArgs.MoveStatus == MoveStatus.MouseClick) 
{
Console.WriteLine(gcMultiRow1.CurrentCellPosition); 
} 
}

Usage in the CellBeginEdit Event

In the CellBeginEdit event, use the CellBeginEditEventArgs class to get the MoveStatus property.
You need to set the GcMultiRow.EditMode property to EditOnEnter, in order to use MoveStatus in the CellBeginEdit event. If the GcMultiRow.EditMode property is not set to EditOnEnter, MoveStatus always gets NoAction.

Usage in the CellEndEdit Event

In the CellEndEdit event, use the CellEndEditEventArgs class to get the MoveStatus property. If you want to use MoveStatus in the CellEndEdit event, the current cell must be in edit mode.

Usage in the NewCellPositionNeeded Event

In the NewCellPositionNeeded event, use the NewCellPositionNeededEventArgs class to get the MoveStatus property.

In the NewCellPositionNeeded event, you can use NewCellPosition property in combination with another operation to change the position when moving the current cell.

Using Code

The following code prevents moving a cell with a mouse click.

[VB]

Imports GrapeCity.Win.MultiRow 
Private Sub GcMultiRow1_NewCellPositionNeeded(sender As Object, e As GrapeCity.Win.MultiRow.NewCellPositionNeededEventArgs) Handles GcMultiRow1.NewCellPositionNeeded 
If e.MoveStatus = MoveStatus.MouseClick Then 
e.NewCellPosition = GcMultiRow1.CurrentCellPosition 
End If 
End Sub

[CS]

using GrapeCity.Win.MultiRow; 
private void gcMultiRow1_NewCellPositionNeeded(object sender, NewCellPositionNeededEventArgs e) 
{ 
if (e.MoveStatus == MoveStatus.MouseClick) 
{ 
e.NewCellPosition = gcMultiRow1.CurrentCellPosition; 
} 
}
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options