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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. GUI implementation

GUI implementation

Scheduled Pinned Locked Moved C / C++ / MFC
c++algorithms
10 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.
  • M Offline
    M Offline
    Morozov Alexey
    wrote on last edited by
    #1

    I have standart generated by ClassWizard SDI MFC-app. I want that some operation invoked by user that may be performed a while was displayed like dialog with progress bar and "Cancel" button. And while it's displaying, operation should performs, progress bar should displays appropriate value and so on till operation has been completed or user has clicked "Cancel" What's the easiest way to implement that. After searching through MSDN some implementation approach has appeared but it's so difficult. Thanks in advance.

    C N T 3 Replies Last reply
    0
    • M Morozov Alexey

      I have standart generated by ClassWizard SDI MFC-app. I want that some operation invoked by user that may be performed a while was displayed like dialog with progress bar and "Cancel" button. And while it's displaying, operation should performs, progress bar should displays appropriate value and so on till operation has been completed or user has clicked "Cancel" What's the easiest way to implement that. After searching through MSDN some implementation approach has appeared but it's so difficult. Thanks in advance.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      It depends on what the process is. If it's under your control ( i.e. you are working with a set of your own data, using your code ), then a modeless dialog box, with a flag being set by pressing the cancel button, and the flag state checked after each iteration through the process taking place in a loop would be the best way. If you're formating a hard drive, or some other process not taking place in your code, you'll need a thread. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

      M 1 Reply Last reply
      0
      • M Morozov Alexey

        I have standart generated by ClassWizard SDI MFC-app. I want that some operation invoked by user that may be performed a while was displayed like dialog with progress bar and "Cancel" button. And while it's displaying, operation should performs, progress bar should displays appropriate value and so on till operation has been completed or user has clicked "Cancel" What's the easiest way to implement that. After searching through MSDN some implementation approach has appeared but it's so difficult. Thanks in advance.

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        You could create a new worker thread. This worker thread can do the background stuff and keep updating the progress control. Thus the cancel button on your main window will still be receptive and not frozen as you might be experiencing now. Nish The lady in red is dancing with me Cheek to cheek There's nobody here It's just you and me It's where I wanna be But I hardly know this beauty by my side I'll never forget the way you look tonight

        C 1 Reply Last reply
        0
        • N Nish Nishant

          You could create a new worker thread. This worker thread can do the background stuff and keep updating the progress control. Thus the cancel button on your main window will still be receptive and not frozen as you might be experiencing now. Nish The lady in red is dancing with me Cheek to cheek There's nobody here It's just you and me It's where I wanna be But I hardly know this beauty by my side I'll never forget the way you look tonight

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          This being the obvious solution, I guessed it may be the 'too hard' solution he found in MSDN. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

          M 1 Reply Last reply
          0
          • C Christian Graus

            It depends on what the process is. If it's under your control ( i.e. you are working with a set of your own data, using your code ), then a modeless dialog box, with a flag being set by pressing the cancel button, and the flag state checked after each iteration through the process taking place in a loop would be the best way. If you're formating a hard drive, or some other process not taking place in your code, you'll need a thread. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

            M Offline
            M Offline
            Morozov Alexey
            wrote on last edited by
            #5

            Thanks but I can't understand how can I implement it in MFC way. Would you mind show me the way :) My task is first ie I want to operate own data Thanks in advance

            C 1 Reply Last reply
            0
            • C Christian Graus

              This being the obvious solution, I guessed it may be the 'too hard' solution he found in MSDN. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

              M Offline
              M Offline
              Morozov Alexey
              wrote on last edited by
              #6

              You're about right :) It's no so hard, but I thought that building new thread, organizing some kind of inter-thread sinchronization is too big to doing such small task. Besides really I have had separate thread that perform that task already. But it's so bulky :( That why I decided to ask simplier solution.

              N 1 Reply Last reply
              0
              • M Morozov Alexey

                You're about right :) It's no so hard, but I thought that building new thread, organizing some kind of inter-thread sinchronization is too big to doing such small task. Besides really I have had separate thread that perform that task already. But it's so bulky :( That why I decided to ask simplier solution.

                N Offline
                N Offline
                Nish Nishant
                wrote on last edited by
                #7

                Morozov Alexey wrote: That why I decided to ask simplier solution. I have always found that the simpler solutions are often the right solutions. The complicated solutions make you feel nice, but often just ends up in a mess. KISS is actually true :-) [except for the 2nd 'S'] Nish The lady in red is dancing with me Cheek to cheek There's nobody here It's just you and me It's where I wanna be But I hardly know this beauty by my side I'll never forget the way you look tonight

                1 Reply Last reply
                0
                • M Morozov Alexey

                  I have standart generated by ClassWizard SDI MFC-app. I want that some operation invoked by user that may be performed a while was displayed like dialog with progress bar and "Cancel" button. And while it's displaying, operation should performs, progress bar should displays appropriate value and so on till operation has been completed or user has clicked "Cancel" What's the easiest way to implement that. After searching through MSDN some implementation approach has appeared but it's so difficult. Thanks in advance.

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

                  Morozov Alexey wrote: After searching through MSDN some implementation approach has appeared but it's so difficult. Have you checked Feb'97 issue of MSJ - "Wicked Code" column by Jeff Prosise contains ready-to-use CWaitDialog class. The article may be in MSDN on your harddisk, if it's not there, go to msdn.microsoft.com Tomasz Sowinski -- http://www.shooltz.com

                  M 1 Reply Last reply
                  0
                  • M Morozov Alexey

                    Thanks but I can't understand how can I implement it in MFC way. Would you mind show me the way :) My task is first ie I want to operate own data Thanks in advance

                    C Offline
                    C Offline
                    Christian Graus
                    wrote on last edited by
                    #9

                    Morozov Alexey wrote: My task is first ie I want to operate own data So you don't have a task, you just want to know how to do it ? CWaitDialog dialog; // A modeless dialog that creates itself in it's constructor for (int i=0;i<10000000;++i) { // do something if (dialog.bStopNow) { // Any necessary cleanup break; } } is all I had in mind. Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002

                    1 Reply Last reply
                    0
                    • T Tomasz Sowinski

                      Morozov Alexey wrote: After searching through MSDN some implementation approach has appeared but it's so difficult. Have you checked Feb'97 issue of MSJ - "Wicked Code" column by Jeff Prosise contains ready-to-use CWaitDialog class. The article may be in MSDN on your harddisk, if it's not there, go to msdn.microsoft.com Tomasz Sowinski -- http://www.shooltz.com

                      M Offline
                      M Offline
                      Morozov Alexey
                      wrote on last edited by
                      #10

                      Thanks a lot :) I'll be searching more carefully in future. Shit, why did I can't find it myself :) It's really what I need.

                      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