CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    388

    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!


  2. #2
    Join Date
    May 1999
    Location
    Reading, England
    Posts
    28

    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured