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. How to handle too many checkbox's click message ?

How to handle too many checkbox's click message ?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
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
    stephen_young
    wrote on last edited by
    #1

    Hi, I have many checkbox button.I want to know which button was clicked when user clicked one of them. How can I use One handle function response the click message,and can get which button has been clicked? Thanks!

    N N 2 Replies Last reply
    0
    • S stephen_young

      Hi, I have many checkbox button.I want to know which button was clicked when user clicked one of them. How can I use One handle function response the click message,and can get which button has been clicked? Thanks!

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      Try the ON_CONTROL_RANGE[^] macro

      nave [My Articles] [My Blog]

      S 1 Reply Last reply
      0
      • S stephen_young

        Hi, I have many checkbox button.I want to know which button was clicked when user clicked one of them. How can I use One handle function response the click message,and can get which button has been clicked? Thanks!

        N Offline
        N Offline
        Nelek
        wrote on last edited by
        #3

        Do this[^] or this[^]help you? On the other hand, it would be nice to know a bit more... Which language are you using? Are all the checkbox independant? or if you select one, some others get unselected (as Radio-buttons)? To handle them you can use a variable to handle all, or each checkbox can have its own variable.

        Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpfull answers is nice, but saying thanks can be even nicer.

        S 1 Reply Last reply
        0
        • N Naveen

          Try the ON_CONTROL_RANGE[^] macro

          nave [My Articles] [My Blog]

          S Offline
          S Offline
          stephen_young
          wrote on last edited by
          #4

          Thank you Naveen,I read the MSDN page you showed me.I think using ON_CONTROL_RANGE can solve my problem.Thanks a lot!

          1 Reply Last reply
          0
          • N Nelek

            Do this[^] or this[^]help you? On the other hand, it would be nice to know a bit more... Which language are you using? Are all the checkbox independant? or if you select one, some others get unselected (as Radio-buttons)? To handle them you can use a variable to handle all, or each checkbox can have its own variable.

            Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpfull answers is nice, but saying thanks can be even nicer.

            S Offline
            S Offline
            stephen_young
            wrote on last edited by
            #5

            Thanks Nelek for your infomation.I use Ms VC6,and I hope when I select one all the others get unselected ( AS you guess :) ). I think ON_CONTROL_RANGE can solve the problem.I will test it. Good luck!

            N 1 Reply Last reply
            0
            • S stephen_young

              Thanks Nelek for your infomation.I use Ms VC6,and I hope when I select one all the others get unselected ( AS you guess :) ). I think ON_CONTROL_RANGE can solve the problem.I will test it. Good luck!

              N Offline
              N Offline
              Nelek
              wrote on last edited by
              #6

              If you don't get that solution working. I suggest you to use radiobutton. Radiobutton is more for exclusive selections and checkbox for multiple selections. Here[^] (section "Using the Dialog in Your Application") you have an example (you can also take a look on the whole contents, it may have infos for other questions you have). [quote from chapter 2] The Check Box Control A check box is a square that the user can click to check or uncheck. The check box control is used to turn a particular value on and off. They are basically on/off switches with an occasional third, in-between state. You normally use check boxes to control discrete, on/off-type variables. The Radio Button Control A radio button is a circle that the user can click to fill with a black spot. The radio button is similar to the check box control, but it is used in a group of two or more where only one of the values can be in the on state at a time. You normally use radio buttons in groups of at least three, surrounded by a group box. The group box allows each group of radio buttons to be independent so that only one radio button in each group can be in the on state at any time. [/quote]

              Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpfull answers is nice, but saying thanks can be even nicer.

              S 1 Reply Last reply
              0
              • N Nelek

                If you don't get that solution working. I suggest you to use radiobutton. Radiobutton is more for exclusive selections and checkbox for multiple selections. Here[^] (section "Using the Dialog in Your Application") you have an example (you can also take a look on the whole contents, it may have infos for other questions you have). [quote from chapter 2] The Check Box Control A check box is a square that the user can click to check or uncheck. The check box control is used to turn a particular value on and off. They are basically on/off switches with an occasional third, in-between state. You normally use check boxes to control discrete, on/off-type variables. The Radio Button Control A radio button is a circle that the user can click to fill with a black spot. The radio button is similar to the check box control, but it is used in a group of two or more where only one of the values can be in the on state at a time. You normally use radio buttons in groups of at least three, surrounded by a group box. The group box allows each group of radio buttons to be independent so that only one radio button in each group can be in the on state at any time. [/quote]

                Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpfull answers is nice, but saying thanks can be even nicer.

                S Offline
                S Offline
                stephen_young
                wrote on last edited by
                #7

                Thanks Nelek for your detailed advice.I will try Radio Button Control.

                N 1 Reply Last reply
                0
                • S stephen_young

                  Thanks Nelek for your detailed advice.I will try Radio Button Control.

                  N Offline
                  N Offline
                  Nelek
                  wrote on last edited by
                  #8

                  You are welcome :)

                  Regards. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpfull answers is nice, but saying thanks can be even nicer.

                  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