RelativeRow, RelativeColumn
These properties tell you which cell of a grid has focus relative to the current position of the data in the grid.
Usage |
nRow = grdGrid.RelativeRow nCol = grdGrid.RelativeColumn |
RelativeColumn can deal with the idea that the column with focus might get scrolled out of the visible part of the grid. If it scrolls off to the right, RelativeColumn just keeps getting bigger. If it scrolls off to the left, RelativeColumn gets negative. RelativeRow, however, isn't that smart. If the current record isn't visible in the grid, RelativeRow becomes 0. (ActiveRow has the same behavior.) |
Example |
* You might check in the grid's Scrolled event to see if * the current record has gone offscreen. IF This.RelativeRow = 0 * do something to move the record pointer so focus is * in the visible area ENDIF |
See Also |
ActivateCell, ActiveColumn, ActiveRow, Columns, ColumnCount, LeftColumn |