Professional UI Solutions
Site Map   /  Register
 
 

Forum

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 Tech Support » Clearing a CExtResizableDialog Collapse All
Subject Author Date
Suhai Gyorgy Oct 9, 2006 - 4:16 AM

Dear Support,

I have a CExtResizableDialog-derived class which I use for inside a control bar to show some pie-charts on it. Drawing the pie-charts happens when WM_PAINT message is received in WindowProc method. I use some data to find out how many and what way the pie-charts should be drawn. But when the data is empty, I don’t want to show any pie-charts at all.

My problem is that after some charts are already drawn and then I get an empty data, I somehow should clear my dialog to not show anything at all. If I used CWnd, I would just draw a white (COLOR_WINDOW) rect over the whole client area of the window, but when using CExtResizableDialog, this approach would not work, as the background depends on the currently used paint manager. Calling UpdateWindow does nothing, calling Invalidate causes infinite loop.

After all my question is: Is there any method of your paint manager that I could call to redraw the dialog’s background?

Thank you:
Chris

Technical Support Oct 9, 2006 - 7:06 AM

There are two options for solving this problem. The first is to use the OnPaint message handler in your dialog class (please note that CClientDC should be used instead of CPaintDC). The second option is to override the WM_PAINT message in the WindowProc virtual method and paint the background yourself. Here is how it may be done:

if( message == WM_PAINT )
{
 ASSERT_VALID( this );
 
 CPaintDC dc( this );
 if( PmBridge_GetPM()->GetCb2DbTransparentMode(this) )
 {
  CExtPaintManager::stat_ExcludeChildAreas(
   dc,
   GetSafeHwnd(),
   CExtPaintManager::stat_DefExcludeChildAreaCallback
   );
  PmBridge_GetPM()->PaintDockerBkgnd( true, dc, this );
 }
 PmBridge_GetPM()->OnPaintSessionComplete( this );
 
 ...
 ...
 ...
}

Suhai Gyorgy Oct 9, 2006 - 7:20 AM

In the meanwhile I’ve done a little investigation myself, and tried to solve the problem like this: If I have no data, I call the following:
if (GetParent() != NULL) PmBridge_GetPM()->PaintControlBarClientArea(*pDC, wndRect, GetParent());

Is this acceptable solution?

One more question: What’s the difference between using OnPaint message handler and overriding WM_PAINT message in WindowProc?

Technical Support Oct 9, 2006 - 12:04 PM

Actually the PaintControlBarClientArea method does the same thing for the dialog, but it is designed for some additional tasks. There is no big difference between the WM_PAINT message and OnPaint handler. The OnPaint method is called through the message map when the WM_PAINT message is received and you can override this behavior in the WindowProc virtual message as it is done in the CExtWS template (see the WindowProc method).