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 » Hidden CExtGroupBox change to visible Collapse All
Subject Author Date
Raphael Verdier Sep 5, 2017 - 10:45 AM

In our software sometime we need to hide some CExtGroupBox.
When we change the text of a CExtGroupBox by using the function SetWindowText, if the CExtGroupBox is hidden, the CExtGroupBox becomes visible.

we reproduce this problem in you Profuis_controls sample.

How to resolve this problem ?

best regards

Raphael Verdier Sep 6, 2017 - 2:48 AM

I found a solution
replacing the function LRESULT CExtGroupBox::WindowProc

by this :

LRESULT CExtGroupBox::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
#if (defined WM_UPDATEUISTATE)    
    ASSERT( WM_UPDATEUISTATE == 0x0128 );
#endif
    // WM_UPDATEUISTATE causes repaint without WM_PAINT, so we eat it
    if( message == 0x0128 )
        return 0;
    if(        message == WM_SETTEXT
        ||    message == WM_ENABLE
        
        )
    {
        BOOL bIsVisible = IsWindowVisible();
        if(message == WM_SETTEXT && !bIsVisible)
        {
            LRESULT lResult = CButton::WindowProc(message, wParam, lParam);
            Invalidate();
            UpdateWindow();
            return lResult;
        }
        SetRedraw( FALSE );
        LRESULT lResult = CButton::WindowProc(message, wParam, lParam);
        SetRedraw( TRUE );
        Invalidate();
        UpdateWindow();
        return lResult;
    }
    if( message == WM_PRINT || message == WM_PRINTCLIENT )
    {
        CDC * pDC = CDC::FromHandle( (HDC)wParam );
        CRect rcClient;
        GetClientRect( &rcClient );
        DoPaint( pDC, rcClient );
        return (!0);
    }    
    return CButton::WindowProc(message, wParam, lParam);
}