I have a MFC application that have a class who inherits from CTabCtrl, on my Main Dialog::OnInit() Method I do.
tabCtrl.InsertItem(0, _T("Tab 1"));
tabCtrl.InsertItem(1, _T("Tab 2"));
tabCtrl.InitDialogs();
tabCtrl.ActivateTabDialogs();
tabCtrl.ShowWindow(SW_SHOW);
tabCtrl is a variable from a class that inherits from CTabCtrl, the method InitDialogs is:
m_Dialog[0]->Create(m_DialogID[0], this);
m_Dialog[1]->Create(m_DialogID[1], this);
m_Dialog[0]->ShowWindow(SW_SHOW);
m_Dialog* is contains both dialog class that I drawn from the resource class.
I see both tabs as I drawn it when I run the program, but when I do something like
UpdateData(TRUE);
valueTest = "tEST";
UpdateData(FALSE);
I get an assertion fail error. My DoDataExchange is being called and it looks like:
void ConfigDialog::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, valueTest);
}
I've been strugling with this for days, and I only been able to found examples with dummy tabs who doesn't have any controls inside them. Is there any step that I'm missing?
Update: The assertion error show this
Microsoft Visual C++ Runtime Library --------------------------- Debug Assertion Failed! Program: C:\Windows\SYSTEM32\mfc140d.dll File: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\wincore.cpp Line: 4355 For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts
And it fails to UpdateData(TRUE) sentence
I assume it's an edit control because it has the ID of IDC_EDIT1. The ASSERT is being given because you do no have a window with the ID of IDC_EDIT1 as a child window of ConfigDialog. Is it a child of one of the tab controls? The DDX_* macros will only work for child windows of your dialog class.
If you have a child window of some tab, try something like:
To retrieve it,