CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Radio Buttons?

  1. #1
    Join Date
    May 1999
    Location
    Arizona, U.S.A.
    Posts
    101

    Radio Buttons?

    I have three radio buttons IDC_RADIO1, IDC_RADIO2 and IDC_RADIO3 IDC_RADIO1 has the group property set and has a member variable (m_radioGrp) of type CButton and the other two do not have anything set. I am able to enable/disable the first button as I please, but can someone please tell me how to do the same for the other two? I have m_radioGrp.SetCheck(0) and this works fine on IDC_RADIO1, but I can't seem to get the other two Radio's to respond to anything! Please provide some code if possible and also can you
    explain why m_radioGrp.CheckRadioButton(0,2,1) doesn't work? I also tried the Control ID numbers 1042,1044,1043 in place of 0,2,1 won't work either? Any assistance is greatly appreciated!

    Thanks!
    Charlie


    Everything is Free Until You Have to Pay for it....

    Platform is Windows 2000/XP Professional, Visual C++ 6.0

  2. #2
    Join Date
    May 1999
    Location
    Texas, USA
    Posts
    568

    Re: Radio Buttons?

    From what you have told me you only have one radio button that has a CButton that is associated with it. Try this instead of calling m_radioGrp.CheckRadioButton(...) call the CDialog version CheckRadioButton(...). That call is from the CWnd class, so even though you can call it with your CButton class, it doesn't make sense. You can either call the CheckRadioButton(...) or map 3 CButton classes (each of your radio buttons) and call the member functions such as SetCheck.

    Wayne



  3. #3
    Join Date
    May 1999
    Location
    Arizona, U.S.A.
    Posts
    101

    Re: Radio Buttons?

    THANK YOU VERY MUCH Wayne! The CDialog CheckRadioButton did the trick!

    This has been a trial but thanks to you I can now get on with it! Thanks Again!

    Everything is Free Until You Have to Pay for it....

    Platform is Windows 2000/XP Professional, Visual C++ 6.0

  4. #4
    Join Date
    May 1999
    Location
    CA, USA
    Posts
    586

    Re: Radio Buttons?

    Another method, is to set the group style for all the radio buttons, then in ClassWizard create member variables for each button. You can then go back and unselect the group style for the appropriate buttons. You can use EnableWindow() to enable/disable the buttons.

    Rail

    Recording Engineer/Software Developer
    Rail Jon Rogut Software
    [email protected]
    http://home.earthlink.net/~railro/

  5. #5
    Join Date
    May 1999
    Location
    Arizona, U.S.A.
    Posts
    101

    Re: Radio Buttons?

    Rail,

    I thought about doing it that way, but couldn't figure out how to implement. You have provided enough info so I can give this a try as well.

    Thanks!
    Charlie

    Everything is Free Until You Have to Pay for it....

    Platform is Windows 2000/XP Professional, Visual C++ 6.0

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