Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 20: List-Based Controls


BOOL CIceScreamOrderDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
m_Flavors.SetCheck(1);
m_Container.SetCheck(1);
m_Ingredient.SetCheck(1);
m_Scoops.SetCheck(1);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}


  1. Test the application

  2. Return to MSVC


19.1.5..Radio Buttons Events..........................................................................


Because a radio is first of all a control of CButton type, when it is clicked, it generates
the BN_CLICKED message. You can use this message to take action in response to the
user’s.

We have mentioned already that a control can have two types of variables: Control or
Value. For a radio button, you can declare or add either a CButton or a regular C++
variable. If you decide to use a CButton variable as done in the previous exercise, you
can call the necessary method to take advantage of the class. On the other hand, if you
want to use a value instead. You can add a variable for only the first radio button of the
group, the radio button that has the Group property set to true. The variable should be an
integer, such as int. In such a case, each radio button of the group can be referred to using
Free download pdf