GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : NewCellPositionNeeded Event |
<SRCategoryAttribute("Behavior")> <SRDescriptionAttribute("Occurs when CurrentCell is moving to a new position.")> Public Event NewCellPositionNeeded As EventHandler(Of NewCellPositionNeededEventArgs)
Dim instance As GcMultiRow Dim handler As EventHandler(Of NewCellPositionNeededEventArgs) AddHandler instance.NewCellPositionNeeded, handler
[SRCategory("Behavior")] [SRDescription("Occurs when CurrentCell is moving to a new position.")] public event EventHandler<NewCellPositionNeededEventArgs> NewCellPositionNeeded
The event handler receives an argument of type NewCellPositionNeededEventArgs containing data related to this event. The following NewCellPositionNeededEventArgs properties provide information specific to this event.
Property | Description |
---|---|
CellIndex | Gets the cell index in its parent Section. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
CellName | Gets the cell name. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
MoveStatus | Gets the status that indicates which behavoir caused the NewCellPositionNeeded event to occur. |
NewCellPosition | Gets or sets a new current cell position. |
RowIndex | Gets the index of the owner Row that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
Scope | Gets the area of the cell that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
SectionIndex | Gets the index of the owner Section that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
The NewCellPositionNeeded event is used to allow the developer to redirect the new cell position when leaving and entering another cell.
The NewCellPositionNeeded event is fired when GcMultRow changes its current cell position from a valid cell position to a new valid cell position. The event order is NewCellPositionNeeded -> CellLeave -> RowLeave -> CellValidating...
The NewCellPositionNeeded event is only fired by keyboard or mouse actions. If you change the CurrentCellPosition or CurrentCell property value with code, the NewCellPositionNeeded event does not fire.
void gcMultiRow1_NewCellPositionNeeded(object sender, NewCellPositionNeededEventArgs e) { if (e.SectionIndex != e.NewCellPosition.SectionIndex) { object projectState = gcMultiRow1[e.SectionIndex,"State"].Value; object description = gcMultiRow1[e.SectionIndex, "Description"].Value; if (description == null || object.Equals(string.Empty, description)) { if(object.Equals(projectState, "Delay")) { MessageBox.Show("If project state is delayed, fill out a description."); e.NewCellPosition = new CellPosition(e.SectionIndex, "Description"); } } } }
Private Sub gcMultiRow1_NewCellPositionNeeded(ByVal sender As Object, ByVal e As NewCellPositionNeededEventArgs) Handles gcMultiRow1.NewCellPositionNeeded If e.SectionIndex <> e.NewCellPosition.SectionIndex Then Dim projectState As Object = gcMultiRow1(e.SectionIndex, "State").Value Dim description As Object = gcMultiRow1(e.SectionIndex, "Description").Value If description = Nothing OrElse Object.Equals(String.Empty, description) Then If Object.Equals(projectState, "Delay") Then MessageBox.Show("If project state is delayed, fill out a description.") e.NewCellPosition = New CellPosition(e.SectionIndex, "Description") End If End If End If End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2