How to create CTabCtrl with dialog as laying
-
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 }
-
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 }
Hope I understood your question
dlg1=new CDlg1(); dlg1->create(...) dlg->GetDlgItem(IDC_TAB1)->ShowWindow(SW_SHOW);
_**
**_
whitesky
-
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 }
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
orCreateDialogIndirect
SaRath.
"Do Next Thing..." My Blog | Understanding State Pattern in C++ -
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 }
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
-
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 }
-
Hope I understood your question
dlg1=new CDlg1(); dlg1->create(...) dlg->GetDlgItem(IDC_TAB1)->ShowWindow(SW_SHOW);
_**
**_
whitesky
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();//<-------------------------------------| }
-
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();//<-------------------------------------| }
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