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 » Another Auto-Hide problem Collapse All
Subject Author Date
Offer Har May 24, 2010 - 1:18 AM

Dear Support,


I have a control-bar and the user have the ability from a command menu to enforce this control-bar to be shown, so this is what I do:



                CExtControlBar::DoFrameBarCheckCmd(pParent, id, false);
This works fine, unless the control-bar is in Auto-Hide mode - then the application crashes. This is the location in the function:

void CExtControlBar::OnFrameBarCheckCmd(
    bool bResizableCheckmarks // = false
    )
{
    ASSERT_VALID( this );
    ASSERT_VALID( m_pDockSite );

    ASSERT(ID_VIEW_STATUS_BAR == AFX_IDW_STATUS_BAR);
    ASSERT(ID_VIEW_TOOLBAR == AFX_IDW_TOOLBAR);
    ASSERT(ID_VIEW_REBAR == AFX_IDW_REBAR);

CFrameWnd * pParentFrame = GetParentFrame();

//    if(        bResizableCheckmarks // (- v.2.23)
//        ||    IsFixedDockStyle()
//        )
bool bVisible = ((GetStyle() & WS_VISIBLE) != 0) ? true : false;
    if(        IsFixedDockStyle()
        ||    ( bResizableCheckmarks && bVisible ) // (+ v.2.23)
        )
    {
        m_pDockSite->ShowControlBar(
            this,
            bVisible ? FALSE : TRUE,
            FALSE
            );
//        SetTimer( __TIMER_ID_DELAYED_UPDATE, 150, NULL );
        return;
    }

    ASSERT( ! IsFixedDockStyle() );

#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
    if( AutoHideModeGet() )
    {
        ASSERT_VALID( m_pDockBar );
        ASSERT_KINDOF( CExtDockBar, m_pDockBar ); <<<<<< THIS ASSERT FAILS
        CExtDynAutoHideArea * pWndAutoHideArea =
            ((CExtDockBar*)m_pDockBar)->_GetAutoHideArea(); <<<<<< HERE IT CRASHES
        ASSERT_VALID( pWndAutoHideArea );
        ASSERT_VALID( pWndAutoHideArea->m_pWndSlider );
        if(        pWndAutoHideArea->m_pWndSlider->m_bActiveState
            &&    pWndAutoHideArea->m_pWndSlider->_GetBar() == this
...

Please fix.


Thanks,


Ron.

Technical Support May 25, 2010 - 1:42 AM

Please check the auto-hidden state first. I.e. do not invoke the CFrameWnd::ShowControlBar() API for the auto-hidden bars:

CExtControlBar * pBar = . . .
CMainFrame * pMainFrame = . . .
            if( pBar->AutoHideModeGet() )
                        pBar->AutoHideModeSet( . . . ); // this API can hide the auto-hidden bar
            else
                        pMainFrame->ShowControlBar( pBar, . . . );