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 » Dynamic bar bug in 2.90, switching states. Collapse All
Subject Author Date
Kevin Murray Jul 22, 2010 - 3:33 PM

I have been able to reproduce this in the MDI-DynamicBars sample in 2.90, but it does not happen in 2.85 sample of the same name.


Basically if you have a Dynamic Bar as an MDI window ("Tabbed Document" in the bar menu), then you select "Floating" from the menu while it is in MDI mode, the bar is floated and invisible.  I know it is there because 1) Spy++ shows the window in its list, but shows it as not visible, and 2) if you exit the application so it saves the bar states, then restart it, the window will be visible and floating.


 


K.

Technical Support Jul 23, 2010 - 6:00 AM

Thank you for reporting this issue. To fix it, please update the source code for the following method:

bool CExtDynamicControlBar::BarStateSet(
	CExtDynamicControlBar::eDynamicBarState_t eDBS,
	bool bShow
	)
{
	ASSERT_VALID( this );
	ASSERT_VALID( m_pDockSite );
	m_eHelperSwitchingDBS = eDBS;
	m_bHelperSwitchingIntoVisibleState = bShow;
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
	if( eDBS == __EDBS_AUTO_HIDDEN && (!bShow) )
		eDBS = __EDBS_DOCKED;
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
CExtDynamicBarSite * pDBS = GetBarSite();
	if( pDBS == NULL )
		return false;
CExtDynamicBarSite::eDetectedUiType_t eDUIT	= pDBS->GetDetectedUiType();
	switch( eDBS )
	{
	case __EDBS_FLOATING:
	{
		m_bAppearInDockSiteControlBarPopupMenu = true;
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
		if( AutoHideModeGet() )
			AutoHideModeSet( false, false, false, true );
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
		bool bFloating = IsFloating();
		CExtMiniDockFrameWnd * pOldMiniDockFrameWndToHide = NULL;
		HWND hWndOldMiniDockFrameWndToHide = NULL;
		bool bHideOldFrame = false;
		CFrameWnd * pParentFrame = GetParentFrame();
		ASSERT( pParentFrame != NULL );
		if( ! bFloating )
		{
			pOldMiniDockFrameWndToHide = DYNAMIC_DOWNCAST( CExtMiniDockFrameWnd, pParentFrame );
			if( pOldMiniDockFrameWndToHide != NULL )
			{
				hWndOldMiniDockFrameWndToHide = pOldMiniDockFrameWndToHide->GetSafeHwnd();
				if( pOldMiniDockFrameWndToHide->_GetSingleVisibleBar() != this )
					pOldMiniDockFrameWndToHide = NULL;
				else
					bHideOldFrame = true;
			}
		}
		else
		{
			OnMoveChildToBar();
			DelayShow( bShow ? TRUE : FALSE );
			if(		(! bShow ) && IsVisible()
				||	bShow && (! IsVisible() )
				)
				OnFrameBarCheckCmd( true ); // show/hide me
			GetParentFrame()->RecalcLayout();
			break;
		}
		OnMoveChildToBar();
		if( ! bFloating )
			FloatControlBar();
		CControlBar::DelayShow( bShow ? TRUE : FALSE );
		if(		hWndOldMiniDockFrameWndToHide != NULL
			&&	pOldMiniDockFrameWndToHide == NULL
			&&	::IsWindow( hWndOldMiniDockFrameWndToHide )
			)
		{
			bHideOldFrame = false;
			pOldMiniDockFrameWndToHide = DYNAMIC_DOWNCAST( CExtMiniDockFrameWnd, CWnd::FromHandlePermanent( ( hWndOldMiniDockFrameWndToHide ) ) );
		}
		if( pOldMiniDockFrameWndToHide != NULL )
		{
			if( bHideOldFrame )
				pOldMiniDockFrameWndToHide->ShowWindow( SW_HIDE );
			CWnd * pWnd = pOldMiniDockFrameWndToHide->GetDlgItem( AFX_IDW_DOCKBAR_FLOAT );
			if( pWnd != NULL )
			{
				pOldMiniDockFrameWndToHide->RepositionBars( 0, 0xFFFF, AFX_IDW_DOCKBAR_FLOAT );
				pWnd = pWnd->GetWindow( GW_CHILD );
				if( pWnd != NULL )
				{
					CExtDynControlBar * pDynControlBar = DYNAMIC_DOWNCAST( CExtDynControlBar, pWnd );
					if( pDynControlBar != NULL )
					{
						if( pDynControlBar->m_pWndDynDocker != NULL )
							pDynControlBar->m_pWndDynDocker->OnDynamicLayoutOptimize();
					}
				}
			}
			pOldMiniDockFrameWndToHide->RepositionBars( 0, 0xFFFF, AFX_IDW_DOCKBAR_FLOAT );
		}
		if(		(! bShow ) && IsVisible()
			||	bShow && (! IsVisible() )
			)
			OnFrameBarCheckCmd( true ); // show/hide me
		CFrameWnd * pWndParentFrame = GetParentFrame();
		ASSERT_VALID( pWndParentFrame );
		ASSERT_KINDOF( CExtMiniDockFrameWnd, pWndParentFrame );
		if( bShow && ( pWndParentFrame->GetStyle() & WS_VISIBLE ) == 0 )
			pWndParentFrame->ShowWindow( SW_SHOWNA );
		else if( (!bShow) && ( pWndParentFrame->GetStyle() & WS_VISIBLE ) != 0 )
			pWndParentFrame->ShowWindow( SW_HIDE );
		if( bShow )
			pWndParentFrame->RecalcLayout();
	}
	break;
	case __EDBS_DOCKED:
	{
		if( IsFloating() )
		{
			m_bAppearInDockSiteControlBarPopupMenu = true;
			OnMoveChildToBar();
			DelayShow( bShow ? TRUE : FALSE );
			if(		(! bShow ) && IsVisible()
				||	bShow && (! IsVisible() )
				)
				OnFrameBarCheckCmd( true ); // show/hide me
			GetParentFrame()->RecalcLayout();
			break;
		}
		CRect rcFrameWnd( 0, 0, 0, 0 );
		CFrameWnd * pWndFrame = GetParentFrame();
		CExtMiniDockFrameWnd * pWndMiniFrame = NULL;
		CExtDynControlBar * pDynControlBar = NULL;
		if( pWndFrame != NULL )
		{
			pWndFrame->GetWindowRect( &rcFrameWnd );
			pWndMiniFrame = DYNAMIC_DOWNCAST( CExtMiniDockFrameWnd, pWndFrame );
			if( pWndMiniFrame != NULL )
			{
				pWndMiniFrame->ModifyStyle( FWS_SNAPTOBARS, 0 );
				CWnd * pWnd = pWndMiniFrame->GetDlgItem( AFX_IDW_DOCKBAR_FLOAT );
				if( pWnd != NULL )
				{
					pWnd = pWnd->GetWindow( GW_CHILD );
					if( pWnd != NULL )
						pDynControlBar = DYNAMIC_DOWNCAST( CExtDynControlBar, pWnd );
				}
			}
		}
		m_bAppearInDockSiteControlBarPopupMenu = true;
		OnMoveChildToBar();
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
		if( AutoHideModeGet() )
		{
			AutoHideModeSet( false, false, true, true );
			if( bShow )
				OnFrameBarCheckCmd( false ); // show me
		} // if( AutoHideModeGet() )
		else
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
		{
			if( bShow )
				m_eDBS = eDBS; // for making OnQueryVisibilityInContainerTabs() returning true
			if(		(! bShow ) && IsVisible()
				||	bShow && (! IsVisible() )
				)
				OnFrameBarCheckCmd( true ); // show/hide me
			if( pWndMiniFrame != NULL )
			{
				CWnd * pWnd = pWndMiniFrame->GetDlgItem( AFX_IDW_DOCKBAR_FLOAT );
				if( pWnd != NULL )
				{
					pWndFrame->MoveWindow( &rcFrameWnd );
					pWndMiniFrame->RepositionBars( 0, 0xFFFF, AFX_IDW_DOCKBAR_FLOAT );
					if( pDynControlBar != NULL )
						pDynControlBar->OnRepositionSingleChild();
				}
				pWndFrame->RecalcLayout();
			}
		} // else from if( AutoHideModeGet() )
	}
	break;
	case __EDBS_DOCUMENT:
		if( OnQueryChildHWND() == NULL )
		{
			ASSERT( FALSE );
			return false;
		} // if( OnQueryChildHWND() == NULL )
		if( eDUIT == CExtDynamicBarSite::__EDUIT_UNSUPPORTED_ENVIRONMENT )
		{
			ASSERT( FALSE );
			return false;
		} // if( OnQueryChildHWND() == NULL )
		m_bAppearInDockSiteControlBarPopupMenu = false;
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
		if( AutoHideModeGet() )
			AutoHideModeSet( false, false, false, true );
		else
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
			if( IsVisible() )
			{
				OnFrameBarCheckCmd( true ); // hide me
				GetParentFrame()->RecalcLayout();
			}
		if( bShow )
			OnMoveChildToDocument();
		else
			OnMoveChildToBar();
	break;
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
	case __EDBS_AUTO_HIDDEN:
		m_bAppearInDockSiteControlBarPopupMenu = true;
		ASSERT( bShow );
		if( ! AutoHideModeGet() )
		{
			OnMoveChildToBar();
			if(		IsFloating()
				||	GetParentFrame() != m_pDockSite
				)
			{
				VERIFY(
					DockControlBarInnerOuter(
						AFX_IDW_DOCKBAR_LEFT,
						false,
						m_pDockSite,
						false
						)
					);
			}
			VERIFY(
				AutoHideModeSet(
					true,
					false,
					true,
					false
					)
				);
		} // if( ! AutoHideModeGet() )
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
	break;
#ifdef _DEBUG
	default:
		{
			ASSERT( FALSE );
		}
	break;
#endif // _DEBUG
	} //switch( eDBS )
	m_eDBS = eDBS;
	if( bShow )
		m_dwAdditionalStateFlags &= ~__EASF_INVISIBLE;
	else
		m_dwAdditionalStateFlags |= __EASF_INVISIBLE;
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
	if( eDBS == __EDBS_AUTO_HIDDEN )
	{
		CExtDockDynTabBar * pDynDockBar =
			DYNAMIC_DOWNCAST(
				CExtDockDynTabBar,
				GetParent()
				);
		if( pDynDockBar != NULL )
		{
			CExtDynTabControlBar * pTabbedBar =
				DYNAMIC_DOWNCAST(
					CExtDynTabControlBar,
					pDynDockBar->GetParent()
					);
			LONG nPos, nCount = pTabbedBar->GetSwitcherItemCount();
			for( nPos = 0; nPos < nCount; nPos++ )
			{
				CExtControlBar * pContainedBar = pTabbedBar->GetBarAt( nPos, true );
				CExtDynamicControlBar * pDynamicBar = DYNAMIC_DOWNCAST( CExtDynamicControlBar, pContainedBar );
				if( pDynamicBar != NULL )
					pDynamicBar->m_eDBS = eDBS;
			} // for( nPos = 0; nPos < nCount; nPos++ )
		} // if( pDynDockBar != NULL )
	}
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
	return true;
}