I have several checkboxes in a dialog box that I want to disable until the user selects an item from a combobox. The only way I can find to disable a checkbox is from the properties window within ClassWizard.
Just call "EnableWindow" function on your checkbox. For example, if your checkbox is named "MyCheckBox", you will use this call in your function.
Code:
MyCheckBox.EnableWindow(FALSE);
So if you have 10 checkboxes, you will call this function for each of them. A checkbox is a window and you can use CWnd functions (EnableWindow is a CWnd function) on them. Check CWnd details in MSDN for more details about it.
When you need to enable these checkboxes at any point, i.e. when your user selects an item from a combobox, call EnableWindow again with parameter TRUE passed to it. Like
Code:
MyCheckBox.EnableWindow(TRUE);
or
MyCheckBox.EnableWindow(); // EnableWindow takes TRUE as default parameter, if none is supplied.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.