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. Closing Dialog window

Closing Dialog window

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
10 Posts 7 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.
  • P Offline
    P Offline
    parichaybp
    wrote on last edited by
    #1

    Hi, I have 3 Dialog window , when the application runs it loads the initial dialog DTDlg from there when I click on next button it opens the 2nd dialog window I have used ( m_dUpdateDlg.DoModal (); ) code to open the 2nd window. From 2nd window when click on next window button it opens the 3rd window ( m_dStatusDlg.DoModal (); ) In this process all the 3 window will be open one above the other I want to know how close the 2nd dialog window then open the 3r d window.?? Please can anyone tell me how to close and then open other dialog window?? Regards, Parichay.

    A G J D 4 Replies Last reply
    0
    • P parichaybp

      Hi, I have 3 Dialog window , when the application runs it loads the initial dialog DTDlg from there when I click on next button it opens the 2nd dialog window I have used ( m_dUpdateDlg.DoModal (); ) code to open the 2nd window. From 2nd window when click on next window button it opens the 3rd window ( m_dStatusDlg.DoModal (); ) In this process all the 3 window will be open one above the other I want to know how close the 2nd dialog window then open the 3r d window.?? Please can anyone tell me how to close and then open other dialog window?? Regards, Parichay.

      A Offline
      A Offline
      abhishekks
      wrote on last edited by
      #2

      where have u put in the code to for calling the constructor for dialogs..?

      P 1 Reply Last reply
      0
      • A abhishekks

        where have u put in the code to for calling the constructor for dialogs..?

        P Offline
        P Offline
        parichaybp
        wrote on last edited by
        #3

        void CCreateDlg::OnOk() { // TODO: Add your control notification handler code here int iResults; // This variable will capture the button selection // Ask the user iResults = MessageBox("Would u like to add documetns to the index now", "Desktop Search",MB_YESNO | MB_ICONQUESTION); // Determine which button the user clicked // Give the user a message showing which button was clicked switch (iResults) { case IDYES: // The Yes button? //call the Update dialog window if user press yes m_dUpdateDlg.DoModal (); break; case IDNO: // The No button? OnOK(); break; } } i have added the code on ok button when user press yes it opens the 2nd dialog box , iwant to know how to close the present dialog box then open the new dialog box.

        A P 2 Replies Last reply
        0
        • P parichaybp

          void CCreateDlg::OnOk() { // TODO: Add your control notification handler code here int iResults; // This variable will capture the button selection // Ask the user iResults = MessageBox("Would u like to add documetns to the index now", "Desktop Search",MB_YESNO | MB_ICONQUESTION); // Determine which button the user clicked // Give the user a message showing which button was clicked switch (iResults) { case IDYES: // The Yes button? //call the Update dialog window if user press yes m_dUpdateDlg.DoModal (); break; case IDNO: // The No button? OnOK(); break; } } i have added the code on ok button when user press yes it opens the 2nd dialog box , iwant to know how to close the present dialog box then open the new dialog box.

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

          Try keeping the oonok call outside swich... it shuld work.... as i have done below void CCreateDlg::OnOk() { // TODO: Add your control notification handler code here int iResults; // This variable will capture the button selection // Ask the user iResults = MessageBox("Would u like to add documetns to the index now", "Desktop Search",MB_YESNO | MB_ICONQUESTION); // Determine which button the user clicked // Give the user a message showing which button was clicked switch (iResults) { case IDYES: // The Yes button? //call the Update dialog window if user press yes m_dUpdateDlg.DoModal (); break; case IDNO: // The No button? break; } OnOK(); }

          P A 2 Replies Last reply
          0
          • A abhishekks

            Try keeping the oonok call outside swich... it shuld work.... as i have done below void CCreateDlg::OnOk() { // TODO: Add your control notification handler code here int iResults; // This variable will capture the button selection // Ask the user iResults = MessageBox("Would u like to add documetns to the index now", "Desktop Search",MB_YESNO | MB_ICONQUESTION); // Determine which button the user clicked // Give the user a message showing which button was clicked switch (iResults) { case IDYES: // The Yes button? //call the Update dialog window if user press yes m_dUpdateDlg.DoModal (); break; case IDNO: // The No button? break; } OnOK(); }

            P Offline
            P Offline
            parichaybp
            wrote on last edited by
            #5

            I changed the code i placed the OnOK() after switch but dialog box is not closing. still the 2nd window is open .. can plz tell me anymore solutins??

            1 Reply Last reply
            0
            • P parichaybp

              void CCreateDlg::OnOk() { // TODO: Add your control notification handler code here int iResults; // This variable will capture the button selection // Ask the user iResults = MessageBox("Would u like to add documetns to the index now", "Desktop Search",MB_YESNO | MB_ICONQUESTION); // Determine which button the user clicked // Give the user a message showing which button was clicked switch (iResults) { case IDYES: // The Yes button? //call the Update dialog window if user press yes m_dUpdateDlg.DoModal (); break; case IDNO: // The No button? OnOK(); break; } } i have added the code on ok button when user press yes it opens the 2nd dialog box , iwant to know how to close the present dialog box then open the new dialog box.

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

              call CDialog::OnOk imeediately before switch -- modified at 5:03 Monday 10th April, 2006

              1 Reply Last reply
              0
              • A abhishekks

                Try keeping the oonok call outside swich... it shuld work.... as i have done below void CCreateDlg::OnOk() { // TODO: Add your control notification handler code here int iResults; // This variable will capture the button selection // Ask the user iResults = MessageBox("Would u like to add documetns to the index now", "Desktop Search",MB_YESNO | MB_ICONQUESTION); // Determine which button the user clicked // Give the user a message showing which button was clicked switch (iResults) { case IDYES: // The Yes button? //call the Update dialog window if user press yes m_dUpdateDlg.DoModal (); break; case IDNO: // The No button? break; } OnOK(); }

                A Offline
                A Offline
                Aryan S
                wrote on last edited by
                #7

                When you are calling the next dialog witn DoModal use EndDialog() before calling the next dialog.

                1 Reply Last reply
                0
                • P parichaybp

                  Hi, I have 3 Dialog window , when the application runs it loads the initial dialog DTDlg from there when I click on next button it opens the 2nd dialog window I have used ( m_dUpdateDlg.DoModal (); ) code to open the 2nd window. From 2nd window when click on next window button it opens the 3rd window ( m_dStatusDlg.DoModal (); ) In this process all the 3 window will be open one above the other I want to know how close the 2nd dialog window then open the 3r d window.?? Please can anyone tell me how to close and then open other dialog window?? Regards, Parichay.

                  G Offline
                  G Offline
                  Ganesh_T
                  wrote on last edited by
                  #8

                  Hi yes, before calling the domodal fr any dialog destroy the previous one by using EndDialog. But I would suggest you implement the child dialog concept. So that when you close the first dialog you will not get he flickering effect. adn there you willnot face problem for closing and switching betwen the dialogs. Cheers "Peace of mind through Technology"

                  1 Reply Last reply
                  0
                  • P parichaybp

                    Hi, I have 3 Dialog window , when the application runs it loads the initial dialog DTDlg from there when I click on next button it opens the 2nd dialog window I have used ( m_dUpdateDlg.DoModal (); ) code to open the 2nd window. From 2nd window when click on next window button it opens the 3rd window ( m_dStatusDlg.DoModal (); ) In this process all the 3 window will be open one above the other I want to know how close the 2nd dialog window then open the 3r d window.?? Please can anyone tell me how to close and then open other dialog window?? Regards, Parichay.

                    J Offline
                    J Offline
                    James R Twine
                    wrote on last edited by
                    #9

                    Keep it simple - open both (the 2nd and 3rd) from the 1st dialog.  When the second dialog is closed it will return a value indicating what button/command was used to close it.     So you can, for example, open the third dialog if the second one returned IDOK.    Peace! -=- James


                    If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
                    Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
                    DeleteFXPFiles & CheckFavorites (Please rate this post!)

                    1 Reply Last reply
                    0
                    • P parichaybp

                      Hi, I have 3 Dialog window , when the application runs it loads the initial dialog DTDlg from there when I click on next button it opens the 2nd dialog window I have used ( m_dUpdateDlg.DoModal (); ) code to open the 2nd window. From 2nd window when click on next window button it opens the 3rd window ( m_dStatusDlg.DoModal (); ) In this process all the 3 window will be open one above the other I want to know how close the 2nd dialog window then open the 3r d window.?? Please can anyone tell me how to close and then open other dialog window?? Regards, Parichay.

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

                      parichaybp wrote:

                      Please can anyone tell me how to close...dialog window??

                      To close a modal dialog, simply call EndDialog().


                      "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

                      "There is no death, only a change of worlds." - 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