>my cursor seems to jump around in the grid after I have sorted my grid through clicking the header. Does anyone know how to keep my cursor from moving around? Help appreciated
>
>Thank You
>Nick Patel
When you change the order of a cursor and a grid has the focus, the top record in the grid is the one that is preserved. Add some code to your header class click that stores the current record number, and relocate on that record after you change the order. Here is the (simplified) code from my grid header class' click method:
THISFORM.LockScreen = .T.
lnSelect = SELECT()
SELE (THIS.Parent.Parent.RecordSource)
lnRecNo = RECNO()
IF LOWER(TAG()) <> THIS.SortTag
SET ORDER TO (THIS.SortTag)
ELSE
IF DESCENDING()
SET ORDER TO (THIS.SortTag) ASCENDING
ELSE
SET ORDER TO (THIS.SortTag) DESCENDING
ENDIF
ENDIF
SELECT (lnselect)
THIS.Parent.Parent.AfterRowColChange()
IF lnRecno > 0
LOCATE RECORD lnRecno
ENDIF
THIS.Parent.Parent.Refresh()
THISFORM.LockScreen = .F.
Erik Moore
Clientelligence