Notification for a group of radio buttons
I have grouped a 5 radio buttons. When the user click anyone of them, certain action must be performed. Do I have to write for whch button clicked button of all 5 buttons? I want to write the code in one place and get it executed when anyone of the button is pressed. Can somebody help!
Re: Notification for a group of radio buttons
Hi,
You can add one change handler for the whole group of Radio buttons but you must make sure that their resource IDs are numbered consecutively in your resource.h file.
Take a look at the ON_CONTROL_RANGE macro.
Heres a handler I use for a group of radio controls where BN_CLICKED is mapped to a single function.
BEGIN_MESSAGE_MAP(CAUIServiceDiagnosticsPage, CAUIPropPage)
//{{AFX_MSG_MAP(CAUIServiceDiagnosticsPage)
ON_BN_CLICKED(IDC_PROPERTIES, OnProperties)
//}}AFX_MSG_MAP
ON_CONTROL_RANGE(BN_CLICKED, IDC_NO_LOGGING_RAD, IDC_HIGH_LOGGING_RAD, OnRadioBtnsClicked)
END_MESSAGE_MAP()
Stuart