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. Simple !?! How to wait for OK

Simple !?! How to wait for OK

Scheduled Pinned Locked Moved C / C++ / MFC
questioncsharptutoriallearning
7 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.
  • J Offline
    J Offline
    Josh Knox
    wrote on last edited by
    #1

    Hi, I've got a function that launches a simple dialog. How do I get the function to wait for the OK button to be pressed before returning? void Import_Shader_Dialog::OnImportShaders() { Some_Dlg Progress; Progress.Create(IDD_IMPORT_SHADER_PROGRESS, NULL); Progress.ShowWindow(SW_SHOW); /*-------- Do Stuff...... ----------*/ //----------------HOW DO I:----------------------- // !!!!!!wait until OK button has been pressed!!!!! //------------------------------------------------ while(its_not_ok); //wait return; } I've tried making the dialog modal but then of course none of the function gets executed while the dialog is up. The way it is, it just appears as long as the function is executing(very quick). So how can I get my child dialog to stay up and receive messages from my program until the OK button is pressed? Thanks Josh josh@that-guy.net

    S T E 3 Replies Last reply
    0
    • J Josh Knox

      Hi, I've got a function that launches a simple dialog. How do I get the function to wait for the OK button to be pressed before returning? void Import_Shader_Dialog::OnImportShaders() { Some_Dlg Progress; Progress.Create(IDD_IMPORT_SHADER_PROGRESS, NULL); Progress.ShowWindow(SW_SHOW); /*-------- Do Stuff...... ----------*/ //----------------HOW DO I:----------------------- // !!!!!!wait until OK button has been pressed!!!!! //------------------------------------------------ while(its_not_ok); //wait return; } I've tried making the dialog modal but then of course none of the function gets executed while the dialog is up. The way it is, it just appears as long as the function is executing(very quick). So how can I get my child dialog to stay up and receive messages from my program until the OK button is pressed? Thanks Josh josh@that-guy.net

      S Offline
      S Offline
      Stan Shannon
      wrote on last edited by
      #2

      Is this dialog intended to be some sort of progress dialog or monitoring dialog of some type for the other code thats processing? "I never met anyone I didn't like" Will Rogers.

      J 1 Reply Last reply
      0
      • J Josh Knox

        Hi, I've got a function that launches a simple dialog. How do I get the function to wait for the OK button to be pressed before returning? void Import_Shader_Dialog::OnImportShaders() { Some_Dlg Progress; Progress.Create(IDD_IMPORT_SHADER_PROGRESS, NULL); Progress.ShowWindow(SW_SHOW); /*-------- Do Stuff...... ----------*/ //----------------HOW DO I:----------------------- // !!!!!!wait until OK button has been pressed!!!!! //------------------------------------------------ while(its_not_ok); //wait return; } I've tried making the dialog modal but then of course none of the function gets executed while the dialog is up. The way it is, it just appears as long as the function is executing(very quick). So how can I get my child dialog to stay up and receive messages from my program until the OK button is pressed? Thanks Josh josh@that-guy.net

        T Offline
        T Offline
        Tomasz Sowinski
        wrote on last edited by
        #3

        If I understand your problem correctly, you just want to display a progress dialog during lenghty operation. If this is the case, have a look at Feb'97 issue of MSJ; there's a column titled 'Wicked Code' which describes CWaitDialog class. Tomasz Sowinski -- http://www.shooltz.com

        J 1 Reply Last reply
        0
        • S Stan Shannon

          Is this dialog intended to be some sort of progress dialog or monitoring dialog of some type for the other code thats processing? "I never met anyone I didn't like" Will Rogers.

          J Offline
          J Offline
          Josh Knox
          wrote on last edited by
          #4

          Yes, It just supposed to display output strings in a listbox. Josh josh@that-guy.net

          S 1 Reply Last reply
          0
          • T Tomasz Sowinski

            If I understand your problem correctly, you just want to display a progress dialog during lenghty operation. If this is the case, have a look at Feb'97 issue of MSJ; there's a column titled 'Wicked Code' which describes CWaitDialog class. Tomasz Sowinski -- http://www.shooltz.com

            J Offline
            J Offline
            Josh Knox
            wrote on last edited by
            #5

            Cool, thanks... Josh josh@that-guy.net

            1 Reply Last reply
            0
            • J Josh Knox

              Yes, It just supposed to display output strings in a listbox. Josh josh@that-guy.net

              S Offline
              S Offline
              Stan Shannon
              wrote on last edited by
              #6

              In that case just follow Tomaz's advice. "I never met anyone I didn't like" Will Rogers.

              1 Reply Last reply
              0
              • J Josh Knox

                Hi, I've got a function that launches a simple dialog. How do I get the function to wait for the OK button to be pressed before returning? void Import_Shader_Dialog::OnImportShaders() { Some_Dlg Progress; Progress.Create(IDD_IMPORT_SHADER_PROGRESS, NULL); Progress.ShowWindow(SW_SHOW); /*-------- Do Stuff...... ----------*/ //----------------HOW DO I:----------------------- // !!!!!!wait until OK button has been pressed!!!!! //------------------------------------------------ while(its_not_ok); //wait return; } I've tried making the dialog modal but then of course none of the function gets executed while the dialog is up. The way it is, it just appears as long as the function is executing(very quick). So how can I get my child dialog to stay up and receive messages from my program until the OK button is pressed? Thanks Josh josh@that-guy.net

                E Offline
                E Offline
                Eric Jacobsen
                wrote on last edited by
                #7

                use Progress.DoModal() but put your function code into the dialog class's InitInstance() so that the function runs when the dialog opens up. Then you can send function-related info to the dialog using member variables of the dialog and UpdateData() Hope this helps...

                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