|
|
|
IntroductionI decided I needed a combination Groupbox and Checkbox control. I wanted all of the controls that lie inside the groupbox to become enabled/disabled in response to a click of a checkbox that is associated with the groupbox. BackgroundI jumped right in and started writing one. When I bogged down I went looking to see if anyone else had tried this. After examining Ming Liu's code from his article "CGroupCheck - Checkbox associated with a groupbox" I solved my problems. I owe him a debt of gratitude for paving the way for me, although I took a different approach to the problem. Using the codeSimply add a groupbox to your dialog, and give it an ID (change the default
id of DDX
void CGroupCheckBoxDemoDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CGroupCheckBoxDemoDlg) DDX_Control(pDX, IDC_GROUP2, m_ctlIgnore); //}}AFX_DATA_MAP DDX_GroupCheck(pDX, IDC_GROUP2, m_bIgnore); } StylesNotice the above dialog contains two styles of
BOOL CGroupCheckBoxDemoDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Change the CGroupCheckBox style from the default.
m_ctlIgnore.SetStyle(CGroupCheckBox::TCH_IGNORE);
return TRUE;
}
Points of InterestOGX fileI find that the easiest way to reuse my classes is to add them to the
Component Gallery. Those classes are then available to you via Class Wizard. In
the case of |
|
|