Function Repository Resource:

ButtonWithStatus

Source Notebook

Create a button whose label changes while its action is being performed

Contributed by: Jon McLoone

ResourceFunction["ButtonWithStatus"][{label1,label2},action]

represents a button that is labeled with label1 and evaluates action whenever it is clicked and is labeled with label2 while action is being performed.

Details and Options

ResourceFunction["ButtonWithStatus"] supports all the same options as Button except for Method.
ResourceFunction["ButtonWithStatus"] always uses Method"Queued".

Examples

Basic Examples (2) 

This button will display "Please wait" for two seconds when clicked:

In[1]:=
ResourceFunction["ButtonWithStatus"][{"Click here", "Please wait"}, Pause[2]]
Out[1]=

When used with only one label, the button will display a progress indicator during the action:

In[2]:=
ResourceFunction["ButtonWithStatus"]["Click here", Pause[2]]
Out[2]=

Scope (1) 

The active label can contain a Dynamic calculation:

In[3]:=
ResourceFunction[
 "ButtonWithStatus"][{"Click here", ProgressIndicator[Dynamic[x], {1, 2000000}]}, x = 0; While[x < 2000000, x++]]
Out[3]=

Publisher

Jon McLoone

Version History

  • 1.0.0 – 01 August 2019

Related Resources

License Information