Neo
  • Neo
  • Member Topic Starter
2020-05-31T20:13:15Z
Hello Igor,

Since Igrid does not implement "row tracking" (maybe in the version 7...), I tried to simulate it using the events "CellMouseEnter" and "MouseLeave".
The principle is very simple.

In the the CellMouseEnter event I use the the SetCurRow method to select the current row.
For sure, this method could be improved. It is just for this test.

Private Sub IGrid1_CellMouseEnter(sender As Object, e As iGCellMouseEnterLeaveEventArgs) Handles IGrid1.CellMouseEnter
        Me.IGrid1.SetCurRow(e.RowIndex)
End Sub


I use the MouseLeave event to detect when the mouse is outside the grid.
When this event is fired, I use the PerformAction method with the action iGActions.DeselectAllRows in order to deselect the current selected row.

Private Sub IGrid1_MouseLeave(sender As Object, e As EventArgs) Handles IGrid1.MouseLeave
        Me.IGrid1.PerformAction(iGActions.DeselectAllRows)
End Sub


I explain my problem :
When I move the cursor inside the grid, everything works perfectly. The "row tracking" is well simulated.
The problem occurs when the mouse leaves the grid and re-enter at the same previous row index.
Indeed, if I leave the grid for instance at the row index 2, the row is well deselected.
But when I enter the grid at the same row index, the row is not selected (the CellMouseEnter is well fired).
If I enter at another row index, the row is selected this time.

I do not understand this behavior and I cannot resolve it using a workaround.
I've attached the VB project.

I really need your lights...

Thank you !

  IgridTest.zip (412kb) downloaded 3 time(s).
Igor/10Tec
2020-06-01T16:27:39Z
I've examined your project. The problem is related to the fact that the DeselectAllRows action is related to the selection status, which is not the same as the current cell or row status in the general case (if multi-selection is on).

To achieve the desired effect in the current version of iGrid.NET, clear the CurRow property like this:
Private Sub IGrid1_MouseLeave(sender As Object, e As EventArgs) Handles IGrid1.MouseLeave
    Me.IGrid1.CurRow = Nothing
End Sub
Neo
  • Neo
  • Member Topic Starter
2020-06-02T07:43:44Z
Hi Igor

Thank you for your quick answer.
I really appreciate.

I had some doubts about the method I used to deselect the current row.
But I never thought to set the CurRow to Nothing...

The solution was so simple 🙂