Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to put a dialog into CDockablePane?

How to put a dialog into CDockablePane?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutoriallearning
9 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eight
    wrote on last edited by
    #1

    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?

    D M 2 Replies Last reply
    0
    • E eight

      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?

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • E eight

        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?

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        I've done this recently In the OnCreate of your derived CDockablePane class, create a dialog with this 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.

        E 1 Reply Last reply
        0
        • M Maximilien

          I've done this recently In the OnCreate of your derived CDockablePane class, create a dialog with this 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.

          E Offline
          E Offline
          eight
          wrote on last edited by
          #4

          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. Added class CTempDlg : public CDialog to use IDD_TEMPDLG 4. Added class CMyDockablePane : public CDockablePane 5. Added an object of CTempDlg, m_TempDlg in CDialogDockableTesterView 6. Overridden CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) with this

          int 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 in CMainFrame::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?

          M 1 Reply Last reply
          0
          • E eight

            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. Added class CTempDlg : public CDialog to use IDD_TEMPDLG 4. Added class CMyDockablePane : public CDockablePane 5. Added an object of CTempDlg, m_TempDlg in CDialogDockableTesterView 6. Overridden CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) with this

            int 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 in CMainFrame::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?

            M Offline
            M Offline
            Maximilien
            wrote on last edited by
            #5

            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.

            E 1 Reply Last reply
            0
            • M Maximilien

              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.

              E Offline
              E Offline
              eight
              wrote on last edited by
              #6

              When I add the line

              myDialog.ShowWindow(SW_SHOW);

              It works! Thanks Maximilien. :)

              I 1 Reply Last reply
              0
              • E eight

                When I add the line

                myDialog.ShowWindow(SW_SHOW);

                It works! Thanks Maximilien. :)

                I Offline
                I Offline
                ima240109
                wrote on last edited by
                #7

                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?

                E 1 Reply Last reply
                0
                • I ima240109

                  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?

                  E Offline
                  E Offline
                  eight
                  wrote on last edited by
                  #8

                  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 1 Reply Last reply
                  0
                  • E eight

                    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 Offline
                    I Offline
                    ima240109
                    wrote on last edited by
                    #9

                    Hi, what i have is a window split horizontally, and the dockpane is tranparent and on the down. what can i do?

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups