c++ - Embedded dialog in Tab Control cannot work in second dialog, MFC -


i have following code works in main dialog, cannot work in second (or third) dialog. thing want each page of tab control can show embedded dialog, it's similar property page.

first create 2 dialog, idd_dialog1 , idd_dialog2.then change style of them child , border none. after add cdialog class each of them.

in maindialog.h, have following code:

#include "dialog1.h" #include "dialog2.h" ... public:     cdialog1 m_para1;     cdialog2 m_para2;     ctabctrl m_tabctrl; 

in maindialog.cpp, use following code embed dialo in oninitdialog:

m_tabctrl.insertitem(0, _t("tab1")); m_tabctrl.insertitem(1, _t("tab2")); m_para1.create(idd_dialog1,getdlgitem(idd_maindialog)); m_para2.create(idd_dialog2,getdlgitem(idd_maindialog));  crect rs; m_tabctrl.getclientrect(&rs);  rs.top+=37; rs.bottom+=8; rs.left+=13; rs.right+=7;  m_para1.movewindow(&rs); m_para2.movewindow(&rs);  m_para1.showwindow(true); m_para2.showwindow(false);   m_tabctrl.setcursel(1); 

by using way, can work in case. if want use method in seconddialog, non-main dialog, cannot work. can me out? in advance.

when create modeless dialog box, try this:

m_para1.create(idd_dialog1,&m_tabctrl); m_para2.create(idd_dialog2,&m_tabctrl); 

the second parameter of create function point parent window object (of type cwnd) dialog object belongs. return type of getdlgitem function hwnd.

see following: http://msdn.microsoft.com/en-us/library/tc46f3be.aspx
http://msdn.microsoft.com/en-us/library/kc6x1ya0.aspx


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -