Skip to main content
Notice removed Reward existing answer by Kuba
Bounty Ended with Albert Retey's answer chosen by Kuba
Notice added Reward existing answer by Kuba
Bounty Started worth 100 reputation by Kuba
edited tags; edited title
Link
Kuba
  • 137.7k
  • 13
  • 289
  • 751

Palette button Button action monitored with progress bar

Tweeted twitter.com/#!/StackMma/status/580037531925921792
Source Link
halirutan
  • 113.4k
  • 7
  • 266
  • 479

Palette button 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?