Hello Metin,
There are two grid properties, ActiveRow and ActiveColumn that may be what you are looking for. Be careful of these, however, they are not robust, and if the grid does not have current focus, or the grid cell with active focus is outside the visible portion of the grid, these may show unexpected values. These are properties that the grid uses for its own purposes, and those purposes may not be the same as ours.
Rather than relying on these properties to find out the location of the current active cell in the grid, create your own properties.
In the Init() of the grid, add the following code:
IF DODEFAULT()
WITH this
.AddProperty( "CurrentActiveRow", .ActiveRow )
.AddProperty( "CurrentActiveColumn", .ActiveColumn )
ENDWITH
RETURN .T.
ENDIF
RETURN .F.
In the AfterRowColChange() event, add this code,
LPARAMETERS nColIndex
WITH this
.CurrentActiveRow = RECNO( .RecordSource )
.CurrentActiveColumn = nColIndex
ENDWITH
RETURN
One warning. The nColIndex integer parameter, despite its name, is not an index into anything. It describes the order in which the column appears in the grid (display order), not the order in which the column appears in the Columns[] collection (index order). If your columns may be reordered at runtime, you will have to do additional work to convert CurrentActiveColumn into an index into the Columns[] collection.
If you need help with that, let me know.
Regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.comNo trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.