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 Tech Support » CExtLabel with a frame problem Collapse All
Subject Author Date
Offer Har Dec 15, 2008 - 7:34 PM

I am trying to have a thin frame around my CExtLabel in an CExtNCW<CExtResizableDialog> dialog.

I tried like this: CExtWRB<CExtLabel>, with no luck.

I debugged the code, and I see that WM_NCPAINT is captured in the CExtWRB class, but for some reason this condition happens, so the function exits before it gets to draw anything:

        case WM_NCPAINT:
                CRect rcInBarWnd, rcInBarClient;
                GetWindowRect( &rcInBarWnd );
                GetClientRect( &rcInBarClient );
                ClientToScreen( &rcInBarClient );
                if( rcInBarWnd == rcInBarClient )
                    return 0;

Why does this happen?

Is this the right way? If not, what is?

Technical Support Dec 18, 2008 - 11:38 AM

All label windows were created by the dialog template loading code and only later subclassed with the CExtWRB-based classes. So the CExtWRB template had no chance to re-compute non-client area of label windows. Please re-compute non-client area of all your CExtWRB-based labels manually. This can be done in the dialog’s OnInitDialog() virtual method:

CExtLabel & wndLabel = . . .

Offer Har Dec 15, 2008 - 7:38 PM

Would like to add that WM_NCCALCSIZE of CExtWRB is never called - maybe it can explain the problem...? why isn’t it called?

Offer Har Dec 15, 2008 - 7:51 PM

More information - if I call AddAnchor on the label and them I resize the dialog, the frame appears... I see that WM_NCCALCSIZE is finally called...

This means that there have to be a way to force resizing for the frame to appear, and the control must have an anchor...

Is there a way to solve this?