Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

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


19.1 Radio Buttons


19.1.1..Introduction..........................................................................................


A radio button is a control that appears as a (proportionately big) dot surrounded by a
round box ?. In reality, a radio button is accompanied by one or more other radio buttons
that appear and behave as a group. The user decides which button is valid by selecting
only one of them. When he or she clicks one button, its round box fills with a (big) dot:
?. When one button is selected, the other round buttons of the (same) group are empty ?.
The user can select another by clicking a new choice, which empties the previous
selection. This technique of selecting is referred to as mutually-exclusive.

To indicate what a radio butto is used for, each one of them is accompanied by a label.
The label is simply a string and it can be positioned to the left, above, to the right, or
under the round box.

Practical Learning: Introducing Radio Buttons



  1. Start Microsoft Visual Studio or Visual C++ if necessary.
    Open the Clarksville Ice Scream1 application. If you did not create, then create a
    Single Document Interface application named Clarksville Ice Scream1

  2. To add a new object, display the Add Resource dialog box and double-click Dialog

  3. Change the Caption of the dialog box to
    Clarksville Ice Scream – Customer Order

  4. Change its ID to IDD_ICESCREAM_ORDER

  5. Add a class for the new dialog box and name it CIceScreamOrderDlg
    Make sure the class is based on CDialog

  6. Press Enter

  7. Display the menu editor and change the caption of the first menu item under File
    from &New\tCtrl+N to &New Order...\tCtrl+N

Free download pdf