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 » Redraw menu bar after removing gripper Collapse All
Subject Author Date
Jase Wolfe Aug 1, 2007 - 1:28 PM

I’m trying to ’lock’ the menubar and toolbars in place by removing the gripper like IE does. When I do this, the grippers on the toolbars remove and with RecalcLayout() called, the toolbars redraw moved slightly to the left like the should to take up the space where the grippers were.

The problem I’m having is with the CExtMenuControlBar. Apparently the call to RecalcLayout does not affect that control. And there is no RecalcLayout function for it. This is the code I’m using for the gripper add/remove function:



BOOL CMainFrame::OnLockTheToolbars(UINT nID)
{
    m_wndMenuBar.SetRedraw( FALSE );

    if (m_bLocked == true)
    {
        m_wndMenuBar.SetBarStyle(
            m_wndMenuBar.GetBarStyle() | CBRS_GRIPPER
            );

        m_wndToolBar.SetBarStyle(
            m_wndToolBar.GetBarStyle() | CBRS_GRIPPER
            );

        m_wndToolBarUiLook.SetBarStyle(
            m_wndToolBarUiLook.GetBarStyle() | CBRS_GRIPPER
            );
    } else {
        m_wndMenuBar.SetBarStyle(
            m_wndMenuBar.GetBarStyle() & ~CBRS_GRIPPER
            );

        m_wndToolBar.SetBarStyle(
            m_wndToolBar.GetBarStyle() & ~CBRS_GRIPPER
            );

        m_wndToolBarUiLook.SetBarStyle(
            m_wndToolBarUiLook.GetBarStyle() & ~CBRS_GRIPPER
            );
    }

    m_wndMenuBar.SetRedraw( TRUE );
    m_wndMenuBar.Invalidate( FALSE );
    m_wndMenuBar.UpdateWindow();

    m_bLocked = !(m_bLocked);

    RecalcLayout();

    


    return 0;
}

Technical Support Aug 2, 2007 - 2:29 PM

You should additionally invoke the following code for your toolbars and menu bar:

m_wndToolBar.SetWindowPos(
	NULL, 0, 0, 0, 0,
	SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
	|SWP_FRAMECHANGED
	);