How to put a dialog into CDockablePane?
-
What I'm trying to do is create a dialog resource, assign some buttons and edit boxes on it and attach it to a CDockablePane object so that I can dock the dialog. How can I do this?
eight wrote:
How can I do this?
Which part exactly?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
What I'm trying to do is create a dialog resource, assign some buttons and edit boxes on it and attach it to a CDockablePane object so that I can dock the dialog. How can I do this?
I've done this recently In the
OnCreate
of your derived CDockablePane class, create a dialog withthis
as the parent of the dialog. something like :int YouDerivedClass::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;m_YourDialog.Create(IDD_SOMETHING, this);
//...
}Do forget to set the style of your dialog to childand no border
This signature was proudly tested on animals.
-
I've done this recently In the
OnCreate
of your derived CDockablePane class, create a dialog withthis
as the parent of the dialog. something like :int YouDerivedClass::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;m_YourDialog.Create(IDD_SOMETHING, this);
//...
}Do forget to set the style of your dialog to childand no border
This signature was proudly tested on animals.
Here are the steps that I took. 1. I've created a new MFC SDI project (
DialogDockableTester
), with Visual Studio style, maximized, and with ribbons. 2. I've created a dialog,IDD_TEMPDLG
. Border = None, Style = Child. 3. Addedclass CTempDlg : public CDialog
to useIDD_TEMPDLG
4. Addedclass CMyDockablePane : public CDockablePane
5. Added an object of CTempDlg,m_TempDlg
inCDialogDockableTesterView
6. OverriddenCMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct)
with thisint CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;m\_TempDlg.Create(IDD\_TEMPDLG, this); return 0;
}
7. Added an object of CMyDockablePane,
m_MyDockablePane
in CMainFrame 8. Added this line inCMainFrame::OnCreate
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
:
:
if (!m_MyDockablePane.Create(_T("MyDockablePane"), this, CRect(0, 0, 200, 200), TRUE, 100, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{
return FALSE; // failed to create
}
m_MyDockablePane.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_MyDockablePane);
return 0;
}Still can't get it to work. Am I missin something?
-
Here are the steps that I took. 1. I've created a new MFC SDI project (
DialogDockableTester
), with Visual Studio style, maximized, and with ribbons. 2. I've created a dialog,IDD_TEMPDLG
. Border = None, Style = Child. 3. Addedclass CTempDlg : public CDialog
to useIDD_TEMPDLG
4. Addedclass CMyDockablePane : public CDockablePane
5. Added an object of CTempDlg,m_TempDlg
inCDialogDockableTesterView
6. OverriddenCMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct)
with thisint CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;m\_TempDlg.Create(IDD\_TEMPDLG, this); return 0;
}
7. Added an object of CMyDockablePane,
m_MyDockablePane
in CMainFrame 8. Added this line inCMainFrame::OnCreate
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
:
:
if (!m_MyDockablePane.Create(_T("MyDockablePane"), this, CRect(0, 0, 200, 200), TRUE, 100, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{
return FALSE; // failed to create
}
m_MyDockablePane.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_MyDockablePane);
return 0;
}Still can't get it to work. Am I missin something?
I just retried with a simple project, and I had to set the dialog visiblity.
int MyPage::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;BOOL bRet = myDialog.Create(IDD\_DIALOG1, this); ASSERT( bRet ); myDialog.ShowWindow(SW\_SHOW); return 0;
}
In my mainframe :
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;CMFCVisualManager::SetDefaultManager(RUNTIME\_CLASS(CMFCVisualManagerWindows)); CMDITabInfo mdiTabParams; mdiTabParams.m\_style = CMFCTabCtrl::STYLE\_3D\_ONENOTE; mdiTabParams.m\_bActiveTabCloseButton = TRUE; mdiTabParams.m\_bTabIcons = FALSE; mdiTabParams.m\_bAutoColor = TRUE; mdiTabParams.m\_bDocumentMenu = TRUE; EnableMDITabbedGroups(TRUE, mdiTabParams);
// ....
CString s2("Page"); if (!myPage.Create(s2, this, CRect(0, 0, 200, 200), TRUE, ID\_OPERATION\_PAGE, WS\_CHILD | WS\_VISIBLE | WS\_CLIPSIBLINGS | WS\_CLIPCHILDREN | CBRS\_LEFT| CBRS\_FLOAT\_MULTI)) { TRACE0("Failed to create objectPage\\n"); return FALSE; // failed to create } myPage.EnableDocking(CBRS\_ALIGN\_ANY); DockPane(&myPage); CDockingManager::SetDockingMode(DT\_SMART); EnableAutoHidePanes(CBRS\_ALIGN\_ANY);
//...
This signature was proudly tested on animals.
-
I just retried with a simple project, and I had to set the dialog visiblity.
int MyPage::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;BOOL bRet = myDialog.Create(IDD\_DIALOG1, this); ASSERT( bRet ); myDialog.ShowWindow(SW\_SHOW); return 0;
}
In my mainframe :
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;CMFCVisualManager::SetDefaultManager(RUNTIME\_CLASS(CMFCVisualManagerWindows)); CMDITabInfo mdiTabParams; mdiTabParams.m\_style = CMFCTabCtrl::STYLE\_3D\_ONENOTE; mdiTabParams.m\_bActiveTabCloseButton = TRUE; mdiTabParams.m\_bTabIcons = FALSE; mdiTabParams.m\_bAutoColor = TRUE; mdiTabParams.m\_bDocumentMenu = TRUE; EnableMDITabbedGroups(TRUE, mdiTabParams);
// ....
CString s2("Page"); if (!myPage.Create(s2, this, CRect(0, 0, 200, 200), TRUE, ID\_OPERATION\_PAGE, WS\_CHILD | WS\_VISIBLE | WS\_CLIPSIBLINGS | WS\_CLIPCHILDREN | CBRS\_LEFT| CBRS\_FLOAT\_MULTI)) { TRACE0("Failed to create objectPage\\n"); return FALSE; // failed to create } myPage.EnableDocking(CBRS\_ALIGN\_ANY); DockPane(&myPage); CDockingManager::SetDockingMode(DT\_SMART); EnableAutoHidePanes(CBRS\_ALIGN\_ANY);
//...
This signature was proudly tested on animals.
-
hi, i've followed your step to pu dialog in dockpane but i can't see the dialog, i don't know how to fix this problem Here are the steps that I took. 1. I've created a new MFC MDI project (DialogDockableTester), with Visual Studio style, maximized, and with ribbons. 2. I've created a dialog, IDD_TEMPDLG. Border = None, Style = Child. 3. Added class CTempDlg : public CDialog to use IDD_TEMPDLG 4. Added class CMyDockablePane : public CDockablePane 5. Overridden CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) with this int CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDockablePane::OnCreate(lpCreateStruct) == -1) return -1; BOOL bRet = m_TempoDlg.Create(IDD_TEMPDLG, this); ASSERT( bRet ); m_TempoDlg.ShowWindow(SW_SHOW); return 0; } 6. Added an object of CMyDockablePane, m_MyDockablePane in CMainFrame 7. Added this line in CMainFrame::OnCreate int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { // .... CString s2("Page"); if (!myPage.Create(s2, this, CRect(0, 0, 200, 200), TRUE, ID_OPERATION_PAGE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI)) { TRACE0("Failed to create objectPage\n"); return FALSE; // failed to create } myPage.EnableDocking(CBRS_ALIGN_ANY); DockPane(&myPage); CDockingManager::SetDockingMode(DT_SMART); EnableAutoHidePanes(CBRS_ALIGN_ANY); //... } in your steps you added an object of CTempDlg, m_TempDlg in CDialogDockableTesterView, and i don'nt know how to use m_TempDlg in CDialogDockableTesterView.cpp Am I missin something?
-
hi, i've followed your step to pu dialog in dockpane but i can't see the dialog, i don't know how to fix this problem Here are the steps that I took. 1. I've created a new MFC MDI project (DialogDockableTester), with Visual Studio style, maximized, and with ribbons. 2. I've created a dialog, IDD_TEMPDLG. Border = None, Style = Child. 3. Added class CTempDlg : public CDialog to use IDD_TEMPDLG 4. Added class CMyDockablePane : public CDockablePane 5. Overridden CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) with this int CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDockablePane::OnCreate(lpCreateStruct) == -1) return -1; BOOL bRet = m_TempoDlg.Create(IDD_TEMPDLG, this); ASSERT( bRet ); m_TempoDlg.ShowWindow(SW_SHOW); return 0; } 6. Added an object of CMyDockablePane, m_MyDockablePane in CMainFrame 7. Added this line in CMainFrame::OnCreate int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { // .... CString s2("Page"); if (!myPage.Create(s2, this, CRect(0, 0, 200, 200), TRUE, ID_OPERATION_PAGE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI)) { TRACE0("Failed to create objectPage\n"); return FALSE; // failed to create } myPage.EnableDocking(CBRS_ALIGN_ANY); DockPane(&myPage); CDockingManager::SetDockingMode(DT_SMART); EnableAutoHidePanes(CBRS_ALIGN_ANY); //... } in your steps you added an object of CTempDlg, m_TempDlg in CDialogDockableTesterView, and i don'nt know how to use m_TempDlg in CDialogDockableTesterView.cpp Am I missin something?
I've recreated your project based on the given codes and it works. IDD_TEMPDLG is visible on the left side of the screen. An idea, CDockablePane state is automatically saved in the registry. If you're familiar with registry, you might want to delete "HKEY_CURRENT_USER > Software > Local App-Wizard Generated Applications > DialogDockableTester".
-
I've recreated your project based on the given codes and it works. IDD_TEMPDLG is visible on the left side of the screen. An idea, CDockablePane state is automatically saved in the registry. If you're familiar with registry, you might want to delete "HKEY_CURRENT_USER > Software > Local App-Wizard Generated Applications > DialogDockableTester".