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 General Discussion » CExtTabWnd flicker onsize. Collapse All
Subject Author Date
Dirk lindner Jan 5, 2009 - 6:28 AM

I use a CExtTabWnd within a CExtResizableDialog.
If i resize the Dialog it looks like:


Any idea ?

#define TOOLBARHEIGHT        31
#define TABHEIGHT            25

void CObjPropDlg::OnSize(UINT nType, int cx, int cy)
{
    CExtResizableDialog::OnSize(nType, cx, cy);
    SetWindowLayout(cx,cy);
}

void CObjPropDlg::SetWindowLayout(int cx, int cy)
{
    if( !m_ctlTitle.GetSafeHwnd() )    
        return;

    CRect rcWindowRect;

    GetWindowRect(&rcWindowRect);
    
    int tabh = TABH;
    if(m_ctlTab.IsWindowVisible()){

        m_ctlTab.MoveWindow(
                    8,
                    16+TOOLBARHEIGHT,
                    cx-16,
                    TABH
        );
    }else
        tabh = 0;

    m_ctlTitle.MoveWindow(
                8,
                0,
                cx-16,
                16
    );

    m_wndToolBar.MoveWindow(
                    8,
                    16,
                    cx-16,
                    TOOLBARHEIGHT
    );



    m_ctlList.MoveWindow(
                    8,
                    16 + tabh + TOOLBARHEIGHT,
                    cx -16,
                    rcWindowRect.bottom - 32 - tabh - TOOLBARHEIGHT
    );
}

Technical Support Jan 6, 2009 - 12:22 PM

If you want flicker free controls on your dialog, then it should have the WS_CLIPSIBLINGS|WS_CLIPCHIDREN styles. Moving dialog controls one by one is not the best approach of implementing layout of dialog controls. You can add dialog anchors to its controls instead:

http://www.prof-uis.com/prof-uis/tech-support/feature-articles/how-to-create-a-window-containing-auto-resizable-controls.aspx

The control anchoring is good feature for most of dialog controls but not for control bars sticking to dialog borders like status bar or non-re-dockable toolbar. Toolbars can reposition themselves automatically if you invoke the CWnd::RepositionBars(0,0xFFFF,0); both in the OnInitDialog() and OnSize() methods.