Hi Doru,
Sorry for delay. Yes, SetFocus on a grid doesn't fire AfterRowColChange when AllowCellelection=.F. I think it's a bug. Anyway, here's a workaround I come up with. Below is only relevant part of your code. Let me know what you think about it.
PROCEDURE RefreshGrid(toGrid)
IF NOT toGrid.AllowCellSelection
Thisform.LockScreen = .T.
toGrid.AllowCellSelection = .T.
toGrid.SetFocus()
toGrid.AllowCellSelection = .F.
Thisform.LockScreen = .F.
ELSE
toGrid.SetFocus()
ENDIF
ENDPROC
PROCEDURE command2.Click
if recno()>1
skip -1
ENDIF
Thisform.RefreshGrid(thisform.grdZ)
ENDPROC
PROCEDURE command3.Click
if recno()<5
skip 1
endif
Thisform.RefreshGrid(thisform.grdZ)
ENDPROC
Don't beat me for the name of the method RefreshGrid. :)
You can peak better one.
>Hi Sergey,
>Just to clear this up...
>Did you try the repro code?
>Can you confirm the SetFocus does
not work with AllowCellelection=.F. (i.e. it does not fire AfterRowColChange)?
>We fixed the problem by replacing SetFocus with AfterRowColChange, but I believe we shouldn't have to call any of the two methods. I think that when you move the record in the grid source, the AfterRowColChange should fire. The way it is now, it is not consistent: visually the grid changes the record marker and the row highlight, but the method code does not run.
>
>...
>>Grid.setfocus() with AllowCellelection=.F. works fine for me. Can you post a simple code that repro this problem?
>...
--sb--