Link to home
Start Free TrialLog in
Avatar of jguerin
jguerin

asked on

ClassWizard member variables.

I have a simple application based on the document/view "paradigm" with the CFormView base view class. I draw little checks and stuff and assign member variables to them. Eg. I'll put in a checkbox and assign it a BOOL m_CheckBox variable through ClassWizard. Now, in this same dialog I have a button that I want to be enabled/disabled depending on whether or not the box is checked. Apparently I can't just say m_button.EnableWindow(m_CheckBox) without first doing a call to UpdateData()... is this how it's supposed to be? And on a side question... does UpdateData() update -all- DDX variables for the particular dialog?

In terms of style and efficiency... what's better? Making a call to UpdateData() everytime I receive a message from the checkbox saying it's been clicked and using the BOOL m_CheckBox variable I created or creating a CButton m_CheckBox control variable that I can tinker with to get the value...

OnCheckBoxClicked(?)
{
UpdateData();
m_ButtonCtrl.EnableWindow(m_CheckBoxVar);
}

or

OnCheckBoxClicked(?)
{
m_ButtonCtrl.EnableWindow(m_CheckBoxCtrl.GetState() & 3);
}

Which one is "correct"? That "& 3" is in there to mask of the state to see if it's clicked or not... Thanks!
ASKER CERTIFIED SOLUTION
Avatar of naveenkohli
naveenkohli

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial