Click here to Skip to main content
11,789,710 members (63,054 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: MFC VC++
I am going to develop mfc dialogue based application in which one scenario there is 3 radio buttons; whenever user click on the 3rd radio button, some controls on the dialog should be disable!!! How can I do that??
Posted 10-Jan-13 20:17pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Add BN_CLICKED handlers for all radio buttons to detect state changings. From within the handler, enable or disable dependant controls according to the button states. With your scenario, one function can handle it all:
// Handler function declared in header as 
//  afx_msg void OnBnClickedRadio();

void CMyDialog::OnBnClickedRadio()
    // Enable controls if radio button 3 is not checked
    CButton *pRadio3 = (CButton*)GetDlgItem(IDC_RBTN_3);
    BOOL bEnable = (BST_CHECKED != pRadio3->GetCheck());
    // Access control by ID
    // Access control by member var

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 999
1 Maciej Los 765
2 KrunalRohit 686
3 CPallini 606
4 Richard MacCutchan 430

Advertise | Privacy | Mobile
Web04 | 2.8.1509028.1 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100