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 create CTabCtrl with dialog as laying

How to create CTabCtrl with dialog as laying

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
7 Posts 5 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.
  • N Offline
    N Offline
    NoName II
    wrote on last edited by
    #1

    wrote smth like this... variables: CTabCtrl m_tabctrl; CDlg1* dlg1; CDlg2*dlg2 MyDialog constructors ... : CDlg1::CDlg1(CWnd* pParent /*=NULL*/) //: CDialog(CDlg1::IDD, pParent) { this->Create(CDlg1::IDD, pParent); this->ShowWindow(SW_NORMAL); } BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); m_tabctrl.InsertItem(0,_T("1111")); m_tabctrl.InsertItem(1,_T("2222")); dlg1=new CDlg1(GetDlgItem(IDC_TAB1)); dlg1->ShowWindow(SW_SHOW);// error IsWindow=false }

    H S Z S 4 Replies Last reply
    0
    • N NoName II

      wrote smth like this... variables: CTabCtrl m_tabctrl; CDlg1* dlg1; CDlg2*dlg2 MyDialog constructors ... : CDlg1::CDlg1(CWnd* pParent /*=NULL*/) //: CDialog(CDlg1::IDD, pParent) { this->Create(CDlg1::IDD, pParent); this->ShowWindow(SW_NORMAL); } BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); m_tabctrl.InsertItem(0,_T("1111")); m_tabctrl.InsertItem(1,_T("2222")); dlg1=new CDlg1(GetDlgItem(IDC_TAB1)); dlg1->ShowWindow(SW_SHOW);// error IsWindow=false }

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      Hope I understood your question dlg1=new CDlg1(); dlg1->create(...) dlg->GetDlgItem(IDC_TAB1)->ShowWindow(SW_SHOW);_**


      **_

      whitesky


      N 1 Reply Last reply
      0
      • N NoName II

        wrote smth like this... variables: CTabCtrl m_tabctrl; CDlg1* dlg1; CDlg2*dlg2 MyDialog constructors ... : CDlg1::CDlg1(CWnd* pParent /*=NULL*/) //: CDialog(CDlg1::IDD, pParent) { this->Create(CDlg1::IDD, pParent); this->ShowWindow(SW_NORMAL); } BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); m_tabctrl.InsertItem(0,_T("1111")); m_tabctrl.InsertItem(1,_T("2222")); dlg1=new CDlg1(GetDlgItem(IDC_TAB1)); dlg1->ShowWindow(SW_SHOW);// error IsWindow=false }

        S Offline
        S Offline
        Sarath C
        wrote on last edited by
        #3

        NoName II wrote:

        dlg1=new CDlg1(GetDlgItem(IDC_TAB1)); dlg1->ShowWindow(SW_SHOW);// error IsWindow=false

        you just allocated the memory. You may have to create the dialog using CreateDialog or CreateDialogIndirect SaRath.
        "Do Next Thing..." My Blog | Understanding State Pattern in C++

        1 Reply Last reply
        0
        • N NoName II

          wrote smth like this... variables: CTabCtrl m_tabctrl; CDlg1* dlg1; CDlg2*dlg2 MyDialog constructors ... : CDlg1::CDlg1(CWnd* pParent /*=NULL*/) //: CDialog(CDlg1::IDD, pParent) { this->Create(CDlg1::IDD, pParent); this->ShowWindow(SW_NORMAL); } BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); m_tabctrl.InsertItem(0,_T("1111")); m_tabctrl.InsertItem(1,_T("2222")); dlg1=new CDlg1(GetDlgItem(IDC_TAB1)); dlg1->ShowWindow(SW_SHOW);// error IsWindow=false }

          Z Offline
          Z Offline
          Zac Howland
          wrote on last edited by
          #4

          I'm not sure whether your purpose for this will allow for it, but you might try using a PropertySheet/PropertyPage setup instead of a tab control. You can configure the PropertySheet to look just like a tab control and don't have to write the transition code yourself. If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

          1 Reply Last reply
          0
          • N NoName II

            wrote smth like this... variables: CTabCtrl m_tabctrl; CDlg1* dlg1; CDlg2*dlg2 MyDialog constructors ... : CDlg1::CDlg1(CWnd* pParent /*=NULL*/) //: CDialog(CDlg1::IDD, pParent) { this->Create(CDlg1::IDD, pParent); this->ShowWindow(SW_NORMAL); } BOOL CMainDlg::OnInitDialog() { CDialog::OnInitDialog(); m_tabctrl.InsertItem(0,_T("1111")); m_tabctrl.InsertItem(1,_T("2222")); dlg1=new CDlg1(GetDlgItem(IDC_TAB1)); dlg1->ShowWindow(SW_SHOW);// error IsWindow=false }

            S Offline
            S Offline
            Sam Hobbs
            wrote on last edited by
            #5

            It has been a while since I worked with CTabCtrl, but I put most of what I know in my article Creating Tab Controls Using CTabCtrl[^].

            1 Reply Last reply
            0
            • H Hamid Taebi

              Hope I understood your question dlg1=new CDlg1(); dlg1->create(...) dlg->GetDlgItem(IDC_TAB1)->ShowWindow(SW_SHOW);_**


              **_

              whitesky


              N Offline
              N Offline
              NoName II
              wrote on last edited by
              #6

              did as u say.... CMyDialog *MyDialog;//in MainDlg header file MyDialog = new CMyDialog; //in mainDlg constructor CMainDlg::OnInitDialog{ TC_ITEM TabItem; TabItem.mask = TCIF_TEXT; TabItem.pszText = _T("111111"); m_tabctrl.InsertItem( 0, &TabItem ); TabItem.mask = TCIF_PARAM; TabItem.lParam = (LPARAM)MyDialog; m_tabctrl.SetItem(0, &TabItem); VERIFY(MyDialog->Create(CMyDialog::IDD, &m_tabctrl)); MyDialog->ShowWindow(SW_SHOW); } CMyDialog constructor CMyDialog::CMyDialog(CWnd* pParent /*=NULL*/) : CDialog(CMyDialog::IDD, pParent) { /*this->Create(CThumbViewDlg::IDD, pParent); this->ShowWindow(SW_NORMAL);*/ } error in HWND CDataExchange::PrepareCtrl if (pSite == NULL) { TRACE(traceAppMsg, 0, "Error: no data exchange control with ID 0x%04X.\n", nIDC); ASSERT(FALSE); AfxThrowNotSupportedException();//<-------------------------------------| }

              H 1 Reply Last reply
              0
              • N NoName II

                did as u say.... CMyDialog *MyDialog;//in MainDlg header file MyDialog = new CMyDialog; //in mainDlg constructor CMainDlg::OnInitDialog{ TC_ITEM TabItem; TabItem.mask = TCIF_TEXT; TabItem.pszText = _T("111111"); m_tabctrl.InsertItem( 0, &TabItem ); TabItem.mask = TCIF_PARAM; TabItem.lParam = (LPARAM)MyDialog; m_tabctrl.SetItem(0, &TabItem); VERIFY(MyDialog->Create(CMyDialog::IDD, &m_tabctrl)); MyDialog->ShowWindow(SW_SHOW); } CMyDialog constructor CMyDialog::CMyDialog(CWnd* pParent /*=NULL*/) : CDialog(CMyDialog::IDD, pParent) { /*this->Create(CThumbViewDlg::IDD, pParent); this->ShowWindow(SW_NORMAL);*/ } error in HWND CDataExchange::PrepareCtrl if (pSite == NULL) { TRACE(traceAppMsg, 0, "Error: no data exchange control with ID 0x%04X.\n", nIDC); ASSERT(FALSE); AfxThrowNotSupportedException();//<-------------------------------------| }

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                one question "VERIFY(MyDialog->Create(CMyDialog::IDD, &m_tabctrl));" your previous code was good this->Create(CThumbViewDlg::IDD, pParent); this->ShowWindow(SW_NORMAL); and why you dont use MyDialog->Create();_**


                **_

                whitesky


                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