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. Is there a Multi-radio button control like the CodeProject Article Voting Control?

Is there a Multi-radio button control like the CodeProject Article Voting Control?

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 3 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.
  • S Offline
    S Offline
    Stone Free
    wrote on last edited by
    #1

    I need a windows control that has multiple radio buttons in a row, to allow the user to select and deselect a number of options specific to a single item. Does this exist, or is the only way to roll my own? If I have to roll my own is the a good article to look at? Thanks

    A 1 Reply Last reply
    0
    • S Stone Free

      I need a windows control that has multiple radio buttons in a row, to allow the user to select and deselect a number of options specific to a single item. Does this exist, or is the only way to roll my own? If I have to roll my own is the a good article to look at? Thanks

      A Offline
      A Offline
      Antti Keskinen
      wrote on last edited by
      #2

      Are you talking about having a row of radio buttons, from which the user can select one ? Then the answer is control grouping. Take any dialog template. Then place the row of radio buttons there. Now, go to the Tab Order option, and make sure that the radio buttons are set into an ascending order so that the first radio button has and index, say, 6, the next is 7 and so on, until the end of the row. Then go to the properties of the first radio button, and check the option 'Group'. All other buttons must NOT have the Group option set. The Group option works so that the first control in the tab order that has the Group option set becomes the first member of the group. All adjacent controls (in the tab order) of similar type belong to the same group until a) another similar control with the group option set is met or b) a different type of control is met. To access this group code-wise, add a member variable to the first radio button control, and take it's value. The value returned is a zero-based index on the radio button that is selected. Like, it's 0 if the first one is selected, 1 if the second and so on.. For a good example, go here[^]. Remember that the radio buttons can be vertically, horizontally or diagonally placed on the dialog. The tab order determines how they are grouped, not their physical position. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

      S 1 Reply Last reply
      0
      • A Antti Keskinen

        Are you talking about having a row of radio buttons, from which the user can select one ? Then the answer is control grouping. Take any dialog template. Then place the row of radio buttons there. Now, go to the Tab Order option, and make sure that the radio buttons are set into an ascending order so that the first radio button has and index, say, 6, the next is 7 and so on, until the end of the row. Then go to the properties of the first radio button, and check the option 'Group'. All other buttons must NOT have the Group option set. The Group option works so that the first control in the tab order that has the Group option set becomes the first member of the group. All adjacent controls (in the tab order) of similar type belong to the same group until a) another similar control with the group option set is met or b) a different type of control is met. To access this group code-wise, add a member variable to the first radio button control, and take it's value. The value returned is a zero-based index on the radio button that is selected. Like, it's 0 if the first one is selected, 1 if the second and so on.. For a good example, go here[^]. Remember that the radio buttons can be vertically, horizontally or diagonally placed on the dialog. The tab order determines how they are grouped, not their physical position. -Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.

        S Offline
        S Offline
        Stone Free
        wrote on last edited by
        #3

        Yes, kind of, the only trouble is that its purpose is to allow the user to select/deselect 0 or more types that a particular row on a database table is applicable for. This means that at runtime every row returned from the database needs to have one of these multi-row radio buttons next to it. I was going to use a Listview control in report view with one of these multi-row radio buttons attached to each item. And then in the OnOK handler for the dialog I would set up the database links according to the types selected for each row.

        D 1 Reply Last reply
        0
        • S Stone Free

          Yes, kind of, the only trouble is that its purpose is to allow the user to select/deselect 0 or more types that a particular row on a database table is applicable for. This means that at runtime every row returned from the database needs to have one of these multi-row radio buttons next to it. I was going to use a Listview control in report view with one of these multi-row radio buttons attached to each item. And then in the OnOK handler for the dialog I would set up the database links according to the types selected for each row.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Stone Free wrote: ...its purpose is to allow the user to select/deselect 0 or more types that a particular row on a database table is applicable for. If the items are mutually exclusive, use checkboxes instead.


          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

          S 1 Reply Last reply
          0
          • D David Crow

            Stone Free wrote: ...its purpose is to allow the user to select/deselect 0 or more types that a particular row on a database table is applicable for. If the items are mutually exclusive, use checkboxes instead.


            "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

            S Offline
            S Offline
            Stone Free
            wrote on last edited by
            #5

            The items arent mutually exclusive, hence 0 or more types. Zero types could be set or 3 of them or all of them. It needs to be a unified control so that I can have one of them for each row in the Listview that have been returned from the database.

            D 1 Reply Last reply
            0
            • S Stone Free

              The items arent mutually exclusive, hence 0 or more types. Zero types could be set or 3 of them or all of them. It needs to be a unified control so that I can have one of them for each row in the Listview that have been returned from the database.

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Stone Free wrote: The items arent mutually exclusive, hence 0 or more types. Exactly my point. With radio buttons, one and only one in a group is selected. With checkboxes, all, some, or none of them can be selected. If you are allowing 0, 3, or all types to be set, then a checkbox is your only option. In your original post, you likened it to a "voting control." When you are voting for a group of related items (e.g., size of pizza, score of an article), you only get to select one of them. If the items are mutually exclusive (e.g., toppings on a pizza, favorite programming language), then you can select any number of them.


              "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

              S 1 Reply Last reply
              0
              • D David Crow

                Stone Free wrote: The items arent mutually exclusive, hence 0 or more types. Exactly my point. With radio buttons, one and only one in a group is selected. With checkboxes, all, some, or none of them can be selected. If you are allowing 0, 3, or all types to be set, then a checkbox is your only option. In your original post, you likened it to a "voting control." When you are voting for a group of related items (e.g., size of pizza, score of an article), you only get to select one of them. If the items are mutually exclusive (e.g., toppings on a pizza, favorite programming language), then you can select any number of them.


                "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                S Offline
                S Offline
                Stone Free
                wrote on last edited by
                #7

                Sorry when I referring to "Voting Control" I was talking about the look of the CodeProject article voting control, rather than its function. OK, if we change this to a row of checkboxes where 0 or more items can be selected. I still need it in the form of a single control that would be able to return its state and live in each of the rows in the Listview control

                D 1 Reply Last reply
                0
                • S Stone Free

                  Sorry when I referring to "Voting Control" I was talking about the look of the CodeProject article voting control, rather than its function. OK, if we change this to a row of checkboxes where 0 or more items can be selected. I still need it in the form of a single control that would be able to return its state and live in each of the rows in the Listview control

                  D Offline
                  D Offline
                  David Crow
                  wrote on last edited by
                  #8

                  Stone Free wrote: OK, if we change this to a row of checkboxes where 0 or more items can be selected. No problem. I've used this control for exactly that purpose. For each row was the name of a scheduled job in column 1, and in the other dozen or so columns were the different permissions (e.g., read, write, execute, delete, manage) for that particular job. Worked great.


                  "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                  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