hi
In an MDI program written in C++, I've this problem. When a new document is creating, it's view is shown repeatedly with different sized until it gets its final size. I put TRACE in OnSize of the corresponding child frame and got the following values:
300x525
300x525
316x563
0x0
560x788
561x789
560x788
This is a weird behavior! I expect only one OnSize be called when the size finally determined and calculated based on tools controls, toolbars, etc. The other behavior which is not justifiable for me is that when a new tabbed document is created, OnMDIActivate is called more than two times. MSDN says that it's called twice, once for the document which is losing activation and once for the document which is gaining activation. But I see that once the new document is activated, then it loses activation and again the older document is activated and again the new one is activated and the old one loses activation! Why is that and how can i avoid it?
thx
PS. I'm going to include the child frame code:
#include "stdafx.h"
#define Uses_CChildFrame
#define Uses_Ct2View
#define Uses_AcItemPropertyPane
#include "hdrs.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx)
ON_WM_MDIACTIVATE()
ON_WM_CHILDACTIVATE()
END_MESSAGE_MAP()
CChildFrame::CChildFrame()
{
d_ActivateFrameWasCalled = false;
}
CChildFrame::~CChildFrame()
{
}
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CMDIChildWndEx::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CMDIChildWndEx::Dump(dc);
}
#endif //_DEBUG
void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd)
{
CMDIChildWndEx::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd);
if (!pActivateWnd) AcGlobals::wndItemPropertyPane->load(NULL);
}
void CChildFrame::ActivateFrame(int nCmdShow)
{
__super::ActivateFrame(nCmdShow);
d_ActivateFrameWasCalled = true;
}
void CChildFrame::OnChildActivate()
{
CMDIChildWndEx::OnChildActivate();
if (d_ActivateFrameWasCalled)
{
CView *pView = GetActiveView();
ASSERT_KINDOF(Ct2View, pView);
Ct2View *pt2View = (Ct2View *)pView;
pt2View->updateItemProperty();
}
}