Hello,
I'm trying to create a very simple SDI application that contains an "Edit Control". This component must fill all available space at initialization and when the window size changes.
1. References
I replace all CFormView references by CBCGPFormView
2. Initialization
void CMyApplicationView::OnInitialUpdate()
{
CBCGPFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
//Added to dock the Edit Control (IDC_EDIT1)
EnableLayout();
CBCGPStaticLayout* pLayout = (CBCGPStaticLayout*)GetLayout();
if (pLayout != NULL)
{
pLayout->AddAnchor(IDC_EDIT1, CBCGPStaticLayout::e_MoveTypeBoth, CBCGPStaticLayout::e_SizeTypeBoth);
}
}
3. Execution
The method "AddAnchor" causes "Debug Assertion Failed" in bcgplayout.cpp
if (m_pHostWnd->GetSafeHwnd () == NULL) => TRUE
When I create a simple application based on CBCGPDialog (with layout definitions in OnInitDialog method) it works perfectly.
Is "OnInitialUpdate" the good place to set my layout definitions ?
Thanks in advance,