GUIKit Example: ThreadedStopCounter

Click for copyable input
Click for copyable input


Note: This example may not be interruptible yet on non-Windows platforms.

This example demonstrates how you can use the option of user interface functions to allow user interface updates to be visible when performing a long Wolfram Language calculation by threading the calculation and ensuring that user interface update requests occur on the event dispatching thread.

Additionally, once a process is threaded, it allows the user to abort a long Wolfram Language calculation from the same user interface. This is accomplished by triggering an abort using , which does not require a kernel script evaluation to interrupt an existing kernel evaluation.

Another important feature of properly interrupting a calculation is proper placement of calls to allow interruption at certain points of the block, and to make sure that the rest of the will continue as expected. All blocks are automatically wrapped with by the GUIKit framework so that, by default, all scripts will evaluate without interruption. You should add blocks in scripts that perform longer calculations.

Click for copyable input