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.
Subject |
Author |
Date |
|
Pierre MEDART
|
Apr 2, 2008 - 9:43 AM
|
We host views in a TabControl that is itself in an object derived from CExtControlBar. CExtControlBar is floating we get an assert (in dbg) if we try to activate the view
in WinFrm.cpp
void
{ CFrameWnd::SetActiveView(CView* pViewNew, BOOL bNotify) line 1184 to 1213 (MFC8.0)
#ifdef
{
ASSERT(IsChild(pViewNew)); <------ we get the assert here
ASSERT_KINDOF(CView, pViewNew);
} _DEBUGif (pViewNew != NULL)
#endif //_DEBUG
CView* pViewOld = m_pViewActive;
if (pViewNew == pViewOld)return; // do not re-activate if SetActiveView called more than once
m_pViewActive = NULL; // no active for the following processing
// deactivate the old one
pViewOld->OnActivateView(FALSE, pViewNew, pViewOld);
if (pViewOld != NULL)// if the OnActivateView moves the active window,
// that will veto this change
if (m_pViewActive != NULL)return; // already set
m_pViewActive = pViewNew;
// activate
pViewNew->OnActivateView(TRUE, pViewNew, pViewOld);
}
Is there a way to create a CExtControlBar that can not be floating ? if (pViewNew != NULL && bNotify)
|
|
Technical Support
|
Apr 2, 2008 - 1:02 PM
|
This assertion is a "feature" of the CFrameWnd class. You can implement a similar SetActiveView() method in your frame class but without unwanted assertions.
You can override the CExtControlBar::FloatControlBar() and CExtControlBar::ToggleDocking() virtual methods in your CExtControlBar -derived class and make the bodies of these methods empty. I.e. do not invoke the parent class methods. The user will not be able to switch such resizable control bar into the floating state. This approach is acceptable if your control bars are based on the Visual Studio .NET like drag-n-drop based re-docking algorithm for resizable bars. This way is not good if you are using Visual Studio 2005/2008 like algorithm with docking markers also known as guide diamonds.
|
|