Skip to main content
2 of 2
edited tags; edited title
Kuba
  • 137.7k
  • 13
  • 289
  • 751

Button action monitored with progress bar

Let's say you have a palette with a button that has to do some time-consuming task when clicked:

downloadMyMovie[] := Pause[10];
CreateWindow[
 PaletteNotebook[
  Button["Do heavy work", downloadMyMovie[]; MessageDialog["Done"]]
 ]
]

Note that the "Done" dialogue is never shown because preemptive evaluations have a shorter time-out than 10s. While I could use Method->"Queued" it would give the impression that the job is finished instantly, because the button does not stick. Then, out of the blue the finish dialogue would pop up.

Question: Is there a simple template code that one can use to show some kind of progress-bar when the task is running so that the user sees the job is still running?

halirutan
  • 113.4k
  • 7
  • 266
  • 479