Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. serveral radio buttons groups on the same dialog

serveral radio buttons groups on the same dialog

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestionlearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Broker2003
    wrote on last edited by
    #1

    Hi, I'm a beginner with VC++ 6.x and I'm becoming crazy. I don't know how to manage several group of radio buttons on the same dialog box... it seems that evey radio buttons are included in the same unique group ! Any ideas ??? thanks !

    I 1 Reply Last reply
    0
    • B Broker2003

      Hi, I'm a beginner with VC++ 6.x and I'm becoming crazy. I don't know how to manage several group of radio buttons on the same dialog box... it seems that evey radio buttons are included in the same unique group ! Any ideas ??? thanks !

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      In short, radio buttons are lumped together by their WS_GROUP style. In the old days, you could do something like:

      CheckRadioButton (hDlg, IDC_FIRSTONE, IDC_LASTONE, idCheckedOne);
      CheckRadioButton (hDlg, IDC_FIRSTTWO, IDC_LASTTWO, idCheckedTwo);

      But you would have to make sure you had non overlapping ids. It was also a pain to find out which button was set in each group. You can now use

      DDX_Radio (pDX, IDC_FIRSTONE, nCheckOne);
      DDX_Radio (pDX, IDC_FIRSTTWO, nCheckTwo);

      in your CMyDlg::DoDataExchange method. To associate buttons in a group together, first make sure every control in your dialog has the group style bit checked. Then set the tab order (ctrl-d) so that successive radio buttons have successive order. Last but not least clear the group style bit for all radio buttons except the first in each group. Good luck, Iain.

      B 1 Reply Last reply
      0
      • I Iain Clarke Warrior Programmer

        In short, radio buttons are lumped together by their WS_GROUP style. In the old days, you could do something like:

        CheckRadioButton (hDlg, IDC_FIRSTONE, IDC_LASTONE, idCheckedOne);
        CheckRadioButton (hDlg, IDC_FIRSTTWO, IDC_LASTTWO, idCheckedTwo);

        But you would have to make sure you had non overlapping ids. It was also a pain to find out which button was set in each group. You can now use

        DDX_Radio (pDX, IDC_FIRSTONE, nCheckOne);
        DDX_Radio (pDX, IDC_FIRSTTWO, nCheckTwo);

        in your CMyDlg::DoDataExchange method. To associate buttons in a group together, first make sure every control in your dialog has the group style bit checked. Then set the tab order (ctrl-d) so that successive radio buttons have successive order. Last but not least clear the group style bit for all radio buttons except the first in each group. Good luck, Iain.

        B Offline
        B Offline
        Broker2003
        wrote on last edited by
        #3

        That's it ! so hard to find such information in the Visual C++ documentation... it saves me a lot of time ! Many thanks

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups