I have a GUI with a number of TabView and other Manipulate controls. Sometimes clicking from one tab view to the other can take a while, and I would like to have a global "Please wait" indicator.
So one way is to implement it for each button or slider, but I would essentially like to have a visual indicator that will show if any cell in my notebook is being evaluated.
Any ideas or suggestions? (Have searched for answers here but I only found those related to progress bars for a specific calculation)
Answer
First, let's make a 'busy' animation
wait =
DynamicModule[
{i = 1, b = Import["http://ims.cartoninjas.net/manifoldtemplate/images/BusyAnimation.gif"]},
Dynamic@Refresh[b[[i = Mod[i + 1, Length[b], 1]]],
UpdateInterval -> .1,
TrackedSymbols -> {}
]
]

Now, lets make a radio button bar to control the busy state in this demo:
Column[{"Waiting", RadioButtonBar[Dynamic[waiting], {True, False}]}]

Finally, here's the TabView. I use Overlay to overlay the busy animation in the busy state and prevent selection of the TabView:
g = {"Beethoven", "CastleWall", "Cone", "Cow"};
Overlay[
{
TabView[(# -> ExampleData[{"Geometry3D", #}] &) /@ g],
Dynamic@If[waiting, wait, "", ""]
},
{1, 2},
Dynamic[If[waiting, 0, 1, 1]],
Alignment -> Top
]

It is the responsibility of your code to set and unset the busy state. Probably somewhere in the beginning and end, respectively, of a Dynamic piece of code in TabView.
Update As of Version 10.0.2 Animator can be used to create the busy animation. There are several kinds available, but one resembling the above can be generated using:
Animator[Appearance -> "Necklace"]

Comments
Post a Comment