Chapter 20: List-Based Controls Visual C++ and MFC Fundamentals
a number. The first radio button of the group would have the index 0, the second would
be 1, etc.
Here is an example:
#pragma once
// CControlsDlg dialog
class CControlsDlg : public CDialog
{
DECLARE_DYNAMIC(CControlsDlg)
public:
CControlsDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CControlsDlg();
// Dialog Data
enum { IDD = IDD_DLG_CONTROLS };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
CString m_Value;
int m_Gender;
void UpdateChoice();
afx_msg void OnBnClickedRdoMale();
afx_msg void OnBnClickedRdoFemale();
afx_msg void OnBnClickedRdoDontknow();
};
// ControlsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Dialog1.h"
#include "ControlsDlg.h"
// CControlsDlg dialog
IMPLEMENT_DYNAMIC(CControlsDlg, CDialog)