This is what I am doing. I am probably doing it wrong. Can someone tell me the right way to do this?
I add a custom control with the class ProfUIS-ScrollItemWindow to the dialog. What I would like to do is add a CExtGridWnd control to the dialog but I do not see how to provide the proper class identification when reviewing the class definition in the header file. I give the control the dialog ID_GRID.
By the way, the sample program PROFUIS_CONTROLS_700 does not work and crashes on my development machine. I am using Microsoft Visual Studio 2005 version 8.0.50727.762 SP.050727-7600 to build with. This sample is where I am getting my clues on how to proceed. I can’t find any official documentation on how to put a grid into a dialog.
Then I declare the following memeber variable in my dialog class.
CExtGridWnd m_cExtGridWnd
Then I add the following to my DDX_Exchange Function
DDX_Control(pDX, IDC_GRID, m_cExtGridWnd);
In my InitDialog function I use the AddAnchor function, and it behaves properly.
AddAnchor(IDC_GRID, __RDA_LT, __RDA_LB);
Then in my InitDialog Function I start adding rows and columns to the grid but it crashes.
m_cExtReportGridWnd.SiwModifyStyle(__ESIS_STH_PIXEL|__ESIS_STV_ITEM|__EGBS_SFM_FULL_ROWS|__EGBS_RESIZING_CELLS_OUTER|__EGBS_DYNAMIC_RESIZING|__EGBS_MULTI_AREA_SELECTION|__EGBS_NO_HIDE_SELECTION|__EGBS_GRIDLINES|__EGBS_LBEXT_SELECTION, 0, FALSE);
m_cExtReportGridWnd.HoverEventsSet(TRUE, TRUE);
m_cExtReportGridWnd.HoverHighlightSet(TRUE, FALSE, FALSE, FALSE, TRUE, TRUE);
long iCol = 0;
CExtGridCellHeader* pHeaderCell = NULL;
m_cExtReportGridWnd.ColumnAdd(1, TRUE);
pHeaderCell = STATIC_DOWNCAST(CExtGridCellHeader, m_cExtReportGridWnd.GridCellGetOuterAtTop(iCol++, 0L, RUNTIME_CLASS(CExtGridCellHeader)));
pHeaderCell->ExtentSet(80);
pHeaderCell->TextSet(_T("MBOL"));
m_cExtReportGridWnd.ColumnAdd(1, TRUE);
pHeaderCell = STATIC_DOWNCAST(CExtGridCellHeader, m_cExtReportGridWnd.GridCellGetOuterAtTop(iCol++, 0L, RUNTIME_CLASS(CExtGridCellHeader)));
pHeaderCell->ExtentSet(60);
pHeaderCell->TextSet(_T("BOL"));
long iRow = m_cExtReportGridWnd.RowCountGet();
int iRet = m_cExtReportGridWnd.RowAdd(1, TRUE);
iCol = 0;
CExtGridCell* pCell = NULL;
// CRASH !!! pCell is always NULL
pCell = m_cExtReportGridWnd.GridCellGet(iCol++, iRow, 0, 0);
pCell->TextSet("3");
pCell = m_cExtReportGridWnd.GridCellGet(iCol++, iRow, 0, 0);
pCell->TextSet("4");