Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtGridWnd Problem Collapse All
Subject Author Date
Johannes Schwenk Jun 10, 2009 - 9:04 AM


I`m trying to use the CExtGridWnd Class to show a Grid with 2 Columns, 1 Header- and 1 Datarow. So I put a Custom Control with the Grid Class Code On my Form. My Code:


CExtGridWnd m_puisgrid_couriers;


void CSelectCourier::DoDataExchange(CDataExchange* pDX) {  CDialog::DoDataExchange(pDX);

 DDX_Control(pDX, IDC_PUISGRID_COURIERS, m_puisgrid_couriers); }


void CSelectCourier::InitControls() {  //*** Steuerelemente initialisieren ***

 //* Courier Grid *

 //Grid  m_puisgrid_couriers.OuterRowCountTopSet( 1L, false );

 //Data Provider  CExtGridDataProvider & m_puisgrid_data = m_puisgrid_couriers.OnGridQueryDataProvider();

 m_puisgrid_data.RowInsert(0,2);  m_puisgrid_data.ColumnInsert(0,2);    CExtGridCellHeader* celltop1 = (CExtGridCellHeader*)m_puisgrid_data.CellGet(   0,   0,   RUNTIME_CLASS(CExtGridCellHeader)  );

 CExtGridCellHeader* celltop2 = (CExtGridCellHeader*)m_puisgrid_data.CellGet(   1,   0,   RUNTIME_CLASS(CExtGridCellHeader)  );

 CExtGridCellRadioButton* cell1 = (CExtGridCellRadioButton*)m_puisgrid_data.CellGet(   0,   1,   RUNTIME_CLASS(CExtGridCellRadioButton)  );

 CExtGridCellString* cell2 = (CExtGridCellString*)m_puisgrid_data.CellGet(   1,   1,   RUNTIME_CLASS(CExtGridCellString)  );

 celltop1->TextSet("Header1");  celltop2->TextSet("Header2");  cell1->SetCheck(1);  cell2->TextSet("12345");


But the result is:


What am I do wrong?

Technical Support Jun 15, 2009 - 2:34 PM

Here is the modified version of your project:

Here is what we changed:

1) We recoded the CProfUisGridDemoProjectDlg::InitControls() method. The direct access to the data provider inside the grid window is needed only for tricky tasks. We used grid control’s methods only.

2) We the CExtNCW < CExtResizableDialog > the base class of the CProfUisGridDemoProjectDlg and CAboutDlg classes. This makes the dialogs themed by Prof-UIS. Then we added the SetAutoSubclassChildControls(); line of code into the CProfUisGridDemoProjectDlg::CProfUisGridDemoProjectDlg constructor. All the un-subclassed dialog controls are now automatically themed by Prof-UIS. That is why the OK and Cancel buttons become themed.

3) We changed the CExtGridWnd m_puisgrid; property of the CProfUisGridDemoProjectDlg class to CExtNSB < CExtGridWnd > m_puisgrid;. So, the grid is now using themed Prof-UIS scroll bars.

4) We added the following lines into the res/ProfUisGridDemoProject.rc2 file:

#if ( !(defined _AFXDLL && !defined __STATPROFUIS_WITH_DLLMFC__) )
      #include <Resources/Resource.rc>
This will make your project working OK if you choose to link with the static Prof-UIS library instead of DLL.

5) We added several test lines into the beginning of the application’s InitInstance() virtual method for testing what we did under different themes.

Johannes Schwenk Jun 16, 2009 - 7:51 AM

Thank you! Works perfect...

Johannes Schwenk Jun 15, 2009 - 7:59 AM

I created a simple project with the problem.

Download Demo Project

Technical Support Jun 11, 2009 - 2:21 AM

Everything is OK. We assume the class name specified in the user control properties is ProfUIS-ScrollItemWindow. Please invoke the following lines of code finally at the end of grid initialization:


Johannes Schwenk Jun 11, 2009 - 4:57 AM

I invoked the lines, but the result is the same. Maybe, the call of  InitControls() is of interest:

BOOL CSelectCourier::OnInitDialog() 

    return TRUE;   // return TRUE unless you set the focus to a control
				  // EXCEPTION: OCX Property Pages should return FALSE

For your Information: I`m Using Visual Studio 2005 and Prof-Uis 2.83.


Technical Support Jun 11, 2009 - 9:26 AM

We believe the problem has to do with something not yet discussed in this forum thread. Could you create a small test project reproducing the problem and send it to the support mail box at this web site?

Johannes Schwenk Jun 15, 2009 - 8:00 AM

I created a simple demo project with a reproduction of the problem

Download Demo Project