Able to resolve the crash it works fine but now when i try to move the dock window to some position in mainframe and try double clicking on the window would dock it to the same position from where it was undocked but an image of the Window remain at the position where it was dragged or placed before docking. And this Window will get closed only if i click on the cross button of the Window that to not exactly on the cross but on the near by coordinates of the cross (ie. in and around the cross button).
I guess the mainframe is not getting Invalidated but calling Invalidate in the OnDockingPaneNotifyis not refreshing the Mainframe. Here is the code :
this is in OnCreate of Mainframe::
if (!InitCommandBars())
return -1;
CXTPPaintManager::SetTheme(xtpThemeOfficeXP);
CXTPCommandBars* pCommandBars = GetCommandBars();
CXTPToolBar* pStandardBar = (CXTPToolBar*)pCommandBars->Add(_T("Standard"), xtpBarTop);
if (!pStandardBar ||
!pStandardBar->LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1;
}
m_paneManager.InstallDockingPanes( this);
m_paneManager.SetTheme(xtpPaneThemeOffice);
pwndPane1 = m_paneManager.CreatePane(
IDR_PANE_OPTIONS, CRect(0, 0,200, 120), xtpPaneDockRight);
pwndPane1->SetTitle ("Draw");
CXTPDockingPane* pwndPaneEdit = m_paneManager.CreatePane(
3, CRect(0, 0,200, 120), xtpPaneDockBottom);
pwndPaneEdit->SetTitle(_T("Diagnostics Window"));
ResetToolboxItems();
CreateTaskPanel();
In OnDockingPaneNotify:
if (wParam == XTP_DPN_SHOWWINDOW)
{CXTPDockingPane* pPane = (CXTPDockingPane*)lParam;
if (!pPane->IsValid())
{
if (pPane->GetID() == IDR_PANE_OPTIONS)
{
if (!m_wndTaskPanel.m_hWnd)
{
CreateTaskPanel();
}
pPane->Attach(&m_wndTaskPanel);
}
if (pPane->GetID() == 3)
{
if (!m_wndEdit.GetSafeHwnd())
{
VERIFY(m_wndEdit.CreateEx(WS_EX_STATICEDGE, _T("EDIT"), _T(""),
WS_CHILD|ES_AUTOVSCROLL|ES_MULTILINE, CRect(0, 0,200, 120), this, 0));
m_wndEdit.SetFont(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
}
pPane->Attach(&m_wndEdit);
}
}
return TRUE; // handled
}
Invalidate();
return FALSE;
}
|