Wolfram Research

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 the same options as Button except for Method.
ResourceFunction["ButtonWithStatus"] always uses Method"Queued".

Examples

Basic Examples

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]=

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]=

Resource History

See Also

License Information