Chapter 20: List-Based Controls Visual C++ and MFC Fundamentals
- When the clerk is about to process a new ice scream order, some radio buttons
should be selected already, those that would be the default.
To select the default radio buttons, display the OnInitDialog() event of the dialog
box and change it as follows:
// IceScreamOrderDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Clarksville Ice Scream1.h"
#include "IceScreamOrderDlg.h"
// CIceScreamOrderDlg dialog
IMPLEMENT_DYNAMIC(CIceScreamOrderDlg, CDialog)
CIceScreamOrderDlg::CIceScreamOrderDlg(CWnd* pParent /*=NULL*/)
: CDialog(CIceScreamOrderDlg::IDD, pParent)
, m_Price(_T("$2.60"))
{
}
CIceScreamOrderDlg::~CIceScreamOrderDlg()
{
}
void CIceScreamOrderDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_FLAVORS, m_Flavors);
DDX_Control(pDX, IDC_RDO_CUP, m_Container);
DDX_Control(pDX, IDC_IGR_NONE, m_Ingredient);
DDX_Control(pDX, IDC_SCOOPS_ONE, m_Scoops);
DDX_Text(pDX, IDC_PRICE, m_Price);
}
BEGIN_MESSAGE_MAP(CIceScreamOrderDlg, CDialog)
END_MESSAGE_MAP()
// CIceScreamOrderDlg message handlers