From: Dean Mark on 9 Mar 2010 08:08 I have a button in my GUI which has to call a function that takes a very long time to run. This function cannot be broken down into a loop or anything of that sort; it is just a single function that completely encapsulates a complicated logic. Now, I want to run this function in the button callback, and display a progress bar to show the user that the GUI is running and is not stuck. AND, I want the user to have an option to abort the function call in the middle. How should I implement this? All the examples I’ve seen so far that use a progress bar, assume that the button's callback function can run the computation iteratively, refresh the progress bar and handle the stop functionality at the same time. But this is not my case because I just have one time consuming function to run. Any ideas?
From: Ashish Uthama on 9 Mar 2010 09:36 On Tue, 09 Mar 2010 08:08:04 -0500, Dean Mark <not(a)real.com> wrote: > I have a button in my GUI which has to call a function that takes a very > long time to run. This function cannot be broken down into a loop or > anything of that sort; it is just a single function that completely > encapsulates a complicated logic. Now, I want to run this function in > the button callback, and display a progress bar to show the user that > the GUI is running and is not stuck. AND, I want the user to have an > option to abort the function call in the middle. How should I implement > this? > > All the examples I’ve seen so far that use a progress bar, assume > that the button's callback function can run the computation iteratively, > refresh the progress bar and handle the stop functionality at the same > time. But this is not my case because I just have one time consuming > function to run. > > Any ideas? A waitbar in conjunction with a timer callback perhaps?
From: Jan Simon on 9 Mar 2010 09:47 Dear Dean! > I have a button in my GUI which has to call a function that takes a very long time to run. This function cannot be broken down into a loop or anything of that sort; it is just a single function that completely encapsulates a complicated logic. If you use a simple TIMER approach, this waitbar will proceed even if your program is stuck. You have to insert any code to update the waitbar or any other progress indicator in the function which takes a long time! If you do not have an estimation of the needed time, a progressbar is meaningless. A simply FPRINTF in 20 important locations is more honest: fprintf('I'm still running (%s)\n', datestr(now, 0)); Kind regards, Jan
|
Pages: 1 Prev: Genetic algorithm toolbox default mutation Next: Simulink and ModelSim automation |