0
votes

I want to build a MFC dialog in which I add a simple TabControl. I want my tab pages to be instances of the same CDialog, but with some different parameters (such as which buttons are shown, for example).

I am using Visual Studio 2008.

I am relatively new to C++, but I've seen that each component (CButton, CDialog) has its own ID (which is static, so I theoretically I can't instance the same component twice).

I would like to know how to do something like this:

for (index = 0 to tabNumber) {
  name = "TAB"+index;
  tabCtrl.add(new CustomDialog(name, i));
}
1
There's actually no problem creating the same dialog as many times as you want. The control IDs are always in reference to the parent dialog window, so there's no conflict. - Mark Ransom

1 Answers

0
votes

You have to give different TabID while creating item.

OnInitDialog()

{
m_cTab.Init();

m_cTab.InsertItem(0,"Register new user");//tabID=0
m_cTab.InsertItem(1,"Identify");// TabID=1

//Register new user m_cTab.CreateButton("Load Image",23,TabID=0, 0, m_cTab.RightOf(22)+15, m_cTab.TopOf(19),60); //Identify m_cTab.CreateButton("Register User",24,TabID=1,P_LEFT,0, m_cTab.TopOf(20) ,60);

}