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 » CExtReportGridWnd: simple grid possible within preview area? Collapse All
Subject Author Date
Oliver Rau Oct 7, 2009 - 7:44 AM

Dear ProfUIS-Team,

clicking (left mouse button) on an arbitrary row in a report grid window should display some structured information about the (complex) item associated with that row. The info could be best introduced by some kind of grid.

My question: is there any chance to put a (simple) grid into the preview area?

Greetings from Germany,


P.S.: hmmm ... we’re still using version 2.82 ...

Technical Support Oct 12, 2009 - 12:37 PM

You can use the CExtPainManager::stat_PrintWnd() static method for capturing the window content:

 static HBITMAP stat_PrintWnd(
            HWND hWnd,
            UINT nMessage = WM_PRINTCLIENT,
            HDC hSrcDC = NULL,
            const RECT * pRectFillSrc = NULL
You have instantiated the grid control correctly. But, we think you don’t need to use the CExtPPVW() template class because you will not need to generate the print/preview content. Then you should create the grid control as window. Your grid control should be created without the WS_VISIBLE style because the grid is needed only for capturing its content. This will solve the HWND handle issue.

Oliver Rau Oct 12, 2009 - 8:05 AM

Following your advice, I’ve created a simple grid ...

ExtPPVW < CExtGridWnd > * m_wndGrid = new CExtPPVW < CExtGridWnd >;
... and filled it with some dummy data. When I try to capture m_wndGrid ...
CExtBitmap * pEBM = CaptureWindow(m_wndGrid->GetSafeHwnd());

... with ...

CExtBitmap * CaptureWindow(HWND hWnd)
    if( ! ::IsWindow(hWnd) )
        return NULL;
    HDC hDCMem = ::CreateCompatibleDC(NULL);
    RECT rect;
    ::GetWindowRect(hWnd, & rect);
    HBITMAP hBmp = NULL;
	    HDC hDC = ::GetDC(hWnd);
	    hBmp = ::CreateCompatibleBitmap(hDC, rect.right - rect.left, rect.bottom -;
	    ::ReleaseDC(hWnd, hDC);
    HGDIOBJ hOld = SelectObject(hDCMem, hBmp);
    ::SelectObject(hDCMem, hOld);
    CExtBitmap * pEBM = new CExtBitmap();
    return pEBM;

... I got an assertion (hWnd == NULL). The reason is obvious: m_wndGrid is not of type CWnd*.

My question as a non-MFC-specialist: how can I get a photo of my m_wndGrid, though? Do I have to put it in a container of class CWnd* first? And do I have to call ShowWindow() before capturing?

Thanks a lot in advance!!


Oliver Rau Oct 15, 2009 - 2:25 AM

Sorry for asking again (my last question might have got lost) ...

How can I get a photo of my m_wndGrid? Is it necessary to call ShowWindow() before capturing?



Technical Support Oct 15, 2009 - 1:04 PM

Here is how we coded the grid photo generation task with additional optional features you may need:

Oliver Rau Oct 16, 2009 - 3:49 AM

Perfect sample - thank you very, very much for this!! You’re doing a great job: powerful product - competent support!

By the way: can you already tell an approximate date for the upcoming release that includes the announced HTML-support?


Technical Support Oct 16, 2009 - 1:24 PM

We need to release Prof-UIS 2.87 this month. HTML features will not be included into it - they are the next step and next release.

Technical Support Oct 8, 2009 - 11:19 AM

The grid window is based on the non-HWND UI elements called grid cells. You can create other grid windows inside one container grid control, but it will not scroll child grids automatically.
There is a better idea. You can use the invisible grid windows, initialize them with data which should be displayed as part of preview areas. You can use the WM_PRINTCLIENT message to get a photo of the invisible grid content. You can save this photo into the CExtBitmap image. Your report grid’s preview areas should simply display these photo images. You can either code your own grid cell class or use the CExtGridCellPicture class as is.

Oliver Rau Oct 8, 2009 - 9:40 AM

Thank’s a lot for your quick reply!

For the moment, I’ve decided to make my own grid cell containing a CExtGridWnd.

What would be the best starting point for doing this? Using an existing class inherited from CExtGridCell as a base (e.g. CExtGridCellButton)? Or are there any examples out there that can be used as a guideline?


Technical Support Oct 8, 2009 - 4:05 AM

The preview area of each row in the report grid is a stand alone grid cell attached to each report grid row using the CExtReportGridItem::PreviewAreaGet() method. You can code a custom grid cell displaying any compound content and use it in report grid’s preview areas. Unfortunately we don’t have a grid cell class displaying a table inside it. But this feature will be available soon with the HTML support everywhere inside Prof-UIS.