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
UpdateDatais an MFC implementation, that stores data from controls to attached instance variables, or restores the control contents back (depending on the argument). - IInspectableASSERT(::IsWindow(m_hWnd)); // calling UpdateData before DoModal?(the comment is interesting). Unless I'm using a different version of MFC than you are. You should update your question and include both the assertion dialog text as well as the code with the failed assertion (press Debug to get there), including a few more lines. - IInspectable