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. Dialog problem!

Dialog problem!

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
10 Posts 6 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

    I have 2 dialog, first dialog I have a checkbox. If you click on that dialog box a new dialog is show and I have a button there and when that button is pressed on I need to end the dialog and the checkbox on the first dialog should not be checked. So how can I do that? Sorry for the bad english.

    M D A 3 Replies Last reply
    0
    • L Larsson

      I have 2 dialog, first dialog I have a checkbox. If you click on that dialog box a new dialog is show and I have a button there and when that button is pressed on I need to end the dialog and the checkbox on the first dialog should not be checked. So how can I do that? Sorry for the bad english.

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Which part do you have so far and which part are you having trouble with? Mark

      1 Reply Last reply
      0
      • L Larsson

        I have 2 dialog, first dialog I have a checkbox. If you click on that dialog box a new dialog is show and I have a button there and when that button is pressed on I need to end the dialog and the checkbox on the first dialog should not be checked. So how can I do that? Sorry for the bad english.

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

        Larsson wrote:

        ...when that button is pressed on I need to end the dialog...

        Just call EndDialog() like would happen if you clicked the OK button.

        Larsson wrote:

        ...and the checkbox on the first dialog should not be checked.

        Just uncheck it with SetCheck().


        "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

          I have 2 dialog, first dialog I have a checkbox. If you click on that dialog box a new dialog is show and I have a button there and when that button is pressed on I need to end the dialog and the checkbox on the first dialog should not be checked. So how can I do that? Sorry for the bad english.

          A Offline
          A Offline
          amjadamq
          wrote on last edited by
          #4

          ok. I think that you are ok with the first part. in the second part, you have two approaches: in the 2nd dlg button write code that looks like this: void CDialog2::OnButton() { (CDialog1 pDlg*)=GetParent(); pDlg->m_ctlCheck1.SetCheck(FALSE); CDialog::OnOK(); } or after exiting the 2nd dialog set a flag and check it in the first diaog regards, Mohammad Gdeisat

          L D 3 Replies Last reply
          0
          • D David Crow

            Larsson wrote:

            ...when that button is pressed on I need to end the dialog...

            Just call EndDialog() like would happen if you clicked the OK button.

            Larsson wrote:

            ...and the checkbox on the first dialog should not be checked.

            Just uncheck it with SetCheck().


            "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
            #5

            How?

            H 1 Reply Last reply
            0
            • A amjadamq

              ok. I think that you are ok with the first part. in the second part, you have two approaches: in the 2nd dlg button write code that looks like this: void CDialog2::OnButton() { (CDialog1 pDlg*)=GetParent(); pDlg->m_ctlCheck1.SetCheck(FALSE); CDialog::OnOK(); } or after exiting the 2nd dialog set a flag and check it in the first diaog regards, Mohammad Gdeisat

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

              Thanks I will tray that!

              1 Reply Last reply
              0
              • A amjadamq

                ok. I think that you are ok with the first part. in the second part, you have two approaches: in the 2nd dlg button write code that looks like this: void CDialog2::OnButton() { (CDialog1 pDlg*)=GetParent(); pDlg->m_ctlCheck1.SetCheck(FALSE); CDialog::OnOK(); } or after exiting the 2nd dialog set a flag and check it in the first diaog regards, Mohammad Gdeisat

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

                Well this is what I get on (CDialog1 pDlg*)=GetParent(); error C2146: syntax error : missing ')' before identifier 'pDlg'

                P 1 Reply Last reply
                0
                • L Larsson

                  Well this is what I get on (CDialog1 pDlg*)=GetParent(); error C2146: syntax error : missing ')' before identifier 'pDlg'

                  P Offline
                  P Offline
                  prasad_som
                  wrote on last edited by
                  #8

                  Larsson wrote:

                  Well this is what I get on (CDialog1 pDlg*)=GetParent();

                  Come on ! what you are trying to do ? I think, CDialog1* pDlg=(CDialog1*)GetParent();

                  Prasad Notifier using ATL | Operator new[],delete[][^]

                  1 Reply Last reply
                  0
                  • L Larsson

                    How?

                    H Offline
                    H Offline
                    Hamid Taebi
                    wrote on last edited by
                    #9

                    :confused: what problems with david crow answer


                    WhiteSky


                    1 Reply Last reply
                    0
                    • A amjadamq

                      ok. I think that you are ok with the first part. in the second part, you have two approaches: in the 2nd dlg button write code that looks like this: void CDialog2::OnButton() { (CDialog1 pDlg*)=GetParent(); pDlg->m_ctlCheck1.SetCheck(FALSE); CDialog::OnOK(); } or after exiting the 2nd dialog set a flag and check it in the first diaog regards, Mohammad Gdeisat

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

                      amjadamq wrote:

                      (CDialog1 pDlg*)=GetParent(); pDlg->m_ctlCheck1.SetCheck(FALSE);

                      Which totally ties the two dialogs together. Not a good design. The preferred solution would be for the second dialog to simply post a message to the firt dialog. In addition, SetCheck() does not take a BOOL argument. It's only by coincidence that FALSE and "unchecked" resolve to 0.


                      "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
                      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