Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

GUIKit Example:
ThreadedStopCounter

Code

In[1]:=
In[2]:=

Example

NOTE: This example may not be interruptable yet on non-Windows platforms.

This example demonstrates how you can use the InvokeThread option of user interface functions to allow user interface updates to be visible when performing a long Mathematica 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 Mathematica calculation from the same user interface. This is accomplished by triggering an abort using BindEvent["action", InvokeMethod[{"ScriptEvaluator","abort"}], 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 CheckAbort[] calls to allow interruption at certain points of the Script block, and to make sure that the rest of the Script will continue as expected. All Script blocks are automatically wrapped with AbortProtect by the GUIKit framework so that, by default, all scripts will evaluate without interruption. You should add CheckAbort blocks in scripts that perform longer calculations.

In[3]:=
Out[3]=


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: