My thread was deleted on this topic for some unknown reason so here we go again:

I need to know how to use tab controls on the document forms of my MDI MFC app. I was getting quite close from zMan's reply, which was:
I found the tab control quite confusing so this is what I did instead. I created separate dialog templates...one for each tab in my control. Then I created them from the OnInitialUpdate() virtual function of CMyFormView... the code goes something like this...


in the MyFormView.h header declare the variables

CMyPage1 m_Page1;
CMyPage2 m_Page2;;
CMyPage3 m_Page3;
CPropertySheet* pSheet;


Code:
 
void CMyFormView::OnInitialUpdate() 
{ 


...this call should really be made from the OnCreate message handler 
.... 
CreateTabControl(); 

} 

void CMyFormView::CreateTabControl() 
{ 


pPropertySheet = new CPropertySheet( "My Tab", this, 0); 

pPropertySheet->AddPage( &m_Page1 ); 
pPropertySheet->AddPage( &m_Page2 ); 
pPropertySheet->AddPage( &m_Page3 ); 

pPropertySheet->Create( this, WS_CHILD | WS_VISIBLE ); 


//** Create a static text with the resource editor where you 
//** would like to position your control and bind a CStatic 
//** member to it... you must change the default idd from 
//** IDC_STATIC to IDC_STATIC1 or something more meaningfull 

CRect r; 
m_staticPlaceHolder.GetWindowRect( &r ); 
ScreenToClient( &r ); 


//** reposition the window where you want it..... 
pPropertySheet->SetWindowPos( pPropertySheet, 
NULL, r.top, r.left, 0, 0, SWP_NOSIZE | SWP_NOZORDER ); 

}

Remember that the page members must be your own classes derived from the CPropertyPage class... to create them with the correct property settings from the resource editor insert new resource ... select DIALOG... then IDD_PROPERTYPAGE_MEDIUM.. you can always resize it... then from the class wizard create the class as you normally would for a dialog but remember to change the base class to CPropertyPage instead of CDialog.... this will add all the necessary code to get you started... and a very important point to remember is that you cannot access the property pages except for the one selected by default until they have been selected by the user or you have set the focus on the through the property sheet member SetActivePage(...)

I hope this helps... I found this much easier to implement than the tab control.....
My problem was that I couldnt assign a member variable to the static text control, even after renaming it to IDC_STATIC1 or IDC_TABLOC. The control didnt appear in the list of controls in the member variables section of the classwizard. Is there a way to assign a variable to a control using the parent's dialog class (CMyDialog)?

Thanks for any help