Visual C++ and MFC Fundamentals Chapter 20: List-Based Controls
A check box that has the Tri-State property set or the BS_3STATE style, can appear
checked, unchecked, or dimmed. When using this kind of check box, the user may have
to click the control three times in order to get the necessary state.
Practical Learning: Creating Check Boxes
- Add a new Dialog resource to the application
- Change its ID to IDD_INGREDIENTS and its Caption to Ingredients Selection
Here is how you will design it: - Add a Group Box control to the dialog box and delete its caption
- On the Controls toolbox, click the Check Box button and click inside the newly
added group box - Change its ID to IDC_CHK_LETTUCE and change its Caption to &Lettuce
- Set its Left Text to True or checked
- Add another check box under the first one. Set its ID to IDC_CHK_ONION, its
Caption to &Onion, and its Left Text property to True - Add another check box under the first one. Set its ID to IDC_CHK_TOMATO, its
Caption to &Tomato, and its Left Text property to True - Add another check box under the first one. Set its ID to IDC_CHK_PICKLES, its
Caption to &Pickle, and its Left Text property to True - Add a class for the dialog box based on CDialog and named CIngredientsDlg
- Add a Value variable for each check box as follows:
ID Value Variable ID Value Variable
IDC_CHK_LETTUCE m_bLettuce IDC_CHK_ONION m_bOnion