<< Return to Main Index

< Return to Class Index

CGXBrowserGrid::GetRecordFromRow

long GetRecordFromRow(ROWCOL nRow);

nRow

Specifies the row id.

Return Value

A zero-based long number.

Remarks

Returns the zero-based row index associated with a row. GetRecordFromRow calls GetRowIndex and converts the row id to a zero-based record index.

If you override OnLoadCellStyle (or any other methods where you connect the grid to your data source), you should always take care to dereference the index associated with a row. This will make it possible to add support for sorting rows. The DbfBrows sample application demonstrates how to add support for sorting the grid.

Example

This sample code shows you how you can use this method to dereference the original record associated with a row:

   // determine the record for the row
   long nRecord = GetRecordFromRow(nRow);

   // now, I can seek to the record
   GetDocument()->m_dbfile.Seek(nRecord);

See Also

CGXBrowserGrid::GetRowIndex CGXBrowserGrid::OnLoadCellStyle

CGXBrowserGrid

Class Overview | Class Members