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. Checkbox?

Checkbox?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
8 Posts 4 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.
  • L Offline
    L Offline
    Larsson
    wrote on last edited by
    #1

    Hello, I cant get my checkbox to work. Here is my problem. I need to do this. If the checkbox is check when I check it I need to uncheck the checkbox and if it uncheck when I press it I need to bring up a new dialog window. I cant get this to work.

    D P S 3 Replies Last reply
    0
    • L Larsson

      Hello, I cant get my checkbox to work. Here is my problem. I need to do this. If the checkbox is check when I check it I need to uncheck the checkbox and if it uncheck when I press it I need to bring up a new dialog window. I cant get this to work.

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

      Are you using MFC?


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      L 1 Reply Last reply
      0
      • L Larsson

        Hello, I cant get my checkbox to work. Here is my problem. I need to do this. If the checkbox is check when I check it I need to uncheck the checkbox and if it uncheck when I press it I need to bring up a new dialog window. I cant get this to work.

        P Offline
        P Offline
        PJ Arends
        wrote on last edited by
        #3

        Larsson wrote:

        if it uncheck when I press it I need to bring up a new dialog window

        Do you want it to be checked also? If so set the style to BS_AUTOCHECKBOX when you create it. Handle the BN_CLICKED command and use GetCheck() to see if the button was checked or unchecked.


        You may be right
        I may be crazy
        -- Billy Joel --

        Within you lies the power for good, use it!!!

        L 1 Reply Last reply
        0
        • D David Crow

          Are you using MFC?


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          L Offline
          L Offline
          Larsson
          wrote on last edited by
          #4

          Yes

          D 1 Reply Last reply
          0
          • P PJ Arends

            Larsson wrote:

            if it uncheck when I press it I need to bring up a new dialog window

            Do you want it to be checked also? If so set the style to BS_AUTOCHECKBOX when you create it. Handle the BN_CLICKED command and use GetCheck() to see if the button was checked or unchecked.


            You may be right
            I may be crazy
            -- Billy Joel --

            Within you lies the power for good, use it!!!

            L Offline
            L Offline
            Larsson
            wrote on last edited by
            #5

            Can you give me an exemple? And yes I want it to be checked.

            1 Reply Last reply
            0
            • L Larsson

              Yes

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

              Via ClassWizard (Ctrl+W), provide a handler for the BN_CLICKED notification message. In it, call the button's GetCheck() method to get the checked state of the button.


              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

              "Judge not by the eye but by the heart." - Native American Proverb

              1 Reply Last reply
              0
              • L Larsson

                Hello, I cant get my checkbox to work. Here is my problem. I need to do this. If the checkbox is check when I check it I need to uncheck the checkbox and if it uncheck when I press it I need to bring up a new dialog window. I cant get this to work.

                S Offline
                S Offline
                Stephen Hewitt
                wrote on last edited by
                #7

                Use ClassWizard to add a BOOL for the checkbox named m_bCheck. Double-click on the checkbox to add a handler. Populate the handler with code like the following:

                void CMFCDialogDlg::OnCheck1()
                {
                UpdateData(TRUE);
                if (m_bCheck)
                {
                // Show your dialog.
                AfxMessageBox(_T("Dialog goes here..."));
                }

                }

                Steve

                L 1 Reply Last reply
                0
                • S Stephen Hewitt

                  Use ClassWizard to add a BOOL for the checkbox named m_bCheck. Double-click on the checkbox to add a handler. Populate the handler with code like the following:

                  void CMFCDialogDlg::OnCheck1()
                  {
                  UpdateData(TRUE);
                  if (m_bCheck)
                  {
                  // Show your dialog.
                  AfxMessageBox(_T("Dialog goes here..."));
                  }

                  }

                  Steve

                  L Offline
                  L Offline
                  Larsson
                  wrote on last edited by
                  #8

                  Thanks that help.

                  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