<< Return to Main Index

< Return to Class Index

CGXDBEGrid::GetFieldFromCol

short GetFieldFromCol(ROWCOL nCol);

nCol

Specifies the column id.

Return Value

A zero-based short index.

Remarks

Returns the zero-based field index associated with a column. GetFieldFromCol calls GetColIndex and converts the column id to a zero-based field index.

If you override OnLoadCellStyle (or any other methods where you connect the grid to your data source), you should always take care to de-reference the index associated with a column. This enables your application to support rearranging columns.

Delegates to CGXBrowserLayoutManager::GetFieldFromCol.

Example

This sample code shows you how you can use this method to de-reference the original field associated with a column:

   // determine field index for the column
   short nField = GetFieldFromCol(nCol);

   // now, I can determine field information
   CField* fld = GetDocument()->m_dbfile.GetField(nField);

See Also

CGXDBEGrid::GetColIndex CGXDBEGrid::OnLoadCellStyle

CGXDBEGrid 

Class Overview | Class Members