I have 3 radio buttons in my Dialog and it's in a group, i have on click event(OnRadio1) for first radio button( ON_BN_CLICKED(IDC_RADIO_ONE, OnRadio1) ), problem is that when dialog box pop's up OnRadio1 is called many times and then dialog will appear.
Please help me.
Pramod

Radio Button Problem
JoeBuddha
daniel111
We can't reproduce the issue. Please log a bug with a repro case at http://lab.msdn.microsoft.com/productfeedback/default.aspx for use to reproduce the problem.
Thanks, Ayman Shoukry VC++ TeamXtamillion
Sorry! I followed your steps and I can not repro the problem.
Can you send me your code as a zip file. You find my email address in my profile.
PRASAD_VIZAG
Just for testing purpouse i have created sample project i will tell the flow. Create New MFC project, deleted the default controls and added one group box and three radio buttons inside the group box. Gropu property for first radio button is checked and double clicked the Radio button and added click event. Code is
void CNewGroupDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
MessageBox("Hi");
}
Ok now if i run the program then "HI" message Box is poped up many times and then dialog appears.
Plase try to create one sample project as above and test and please explain me the behaviour.
Pramod
EdmundMS
ID value of IDC_RADIO_ONE is 1000 and it is not repeated.
If i declare one variable to the group say 'm_index' and assign Zero i,e m_index = 0; UpdateData(false);
in OnInitDialog() then it's working fine but if i comment this two line then it is not working i am not able to understand why it is like this.
TFSAdmin
DragonFly2
This is DoDataExchange and Messagemap
void CGroupDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGroupDlg)
DDX_Radio(pDX, IDC_RADIO_ONE, m_index);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGroupDlg, CDialog)
//{{AFX_MSG_MAP(CGroupDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_RADIO_ONE, OnRadio1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
MAZIN
Lightening
Katana
Can you post the complete Messagemap and the complete DoDataExchange section
Try to use Spy++ to check if there are other controls with the CtrlID 1000