//-------------------- sheet constructor
CMySheet::CMySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
AddPage( &m_cMyPg1 );
AddPage( &m_cMyPg2 );
}
//-------------------- sheet initialization
BOOL CMySheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
MoveWindow(4,75,360,450,TRUE);
return bResult;
}
//------- intialize the parent dialog box
BOOL CD50Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_pSheet= new CMySheet("PropSheet", this);
// m_pSheet->Create(this,WS_CHILD | WS_VISIBLE,WS_EX_CONTROLPARENT);
m_pSheet->Create(this,WS_CHILD | WS_VISIBLE ); // <<<<< changed
return TRUE;
}
//------- button handling in parent dialog box
void CD50Dlg::OnRadio2() { DoEnabling(); }
void CD50Dlg::OnRadio1() { DoEnabling(); }
void CD50Dlg::DoEnabling()
{
BOOL fEnableEdit= TRUE;
CButton* pRb1= (CButton*)GetDlgItem( IDC_RADIO1 );
CButton* pRb2= (CButton*)GetDlgItem( IDC_RADIO2 );
if ( pRb1->GetCheck()==1 ) { // button 1 is selected, disable
fEnableEdit= FALSE;
}
if ( pRb2->GetCheck()==1 ) { // button 2 is selected, enable
fEnableEdit= TRUE;
}
CMyPg1* pPg1= (CMyPg1*)m_pSheet->GetPage(0);
pPg1->m_ctlEditFileName.EnableWindow( fEnableEdit );
}
|