Article Details
| Id: | 10655 |
| Product: | finPOWER Connect |
| Type: | NEW |
| Version: | 1.06.05 |
| Opened: | 01/11/2012 |
| Closed: | 07/11/2012 |
| Released: | 26/11/2012 |
| Job: | J010644 |
Scripts can now display progress form and allow the User to cancel them
Script can now display a progress form and give the User the ability to cancel them.
The following code sample shows how to display a progress box with the ability to cancel.
Public Function Main(ByVal parameters As ISKeyValueList) As BooleanConst LoopMax As Integer = 1000Dim Cancelled As BooleanDim i As Integer' Assume SuccessMain = True' Status BeginfinBL.StatusProcessBegin("Progress Status Test", "Initialising", True)' SleepSystem.Threading.Thread.Sleep(2000)' ProgressFor i = 0 To LoopMax' ProgressfinBL.StatusProcess((i / LoopMax) * 100, "Item " & CStr(i), Cancelled)' Cancelled?If Cancelled ThenMain = FalsefinBL.Error.ErrorBegin("Script was cancelled by the User.")Exit ForEnd If' SleepSystem.Threading.Thread.Sleep(10)Next' Status EndfinBL.StatusProcessEnd()End Function
NOTE: Do not allow the Script to be cancelled unless your Script is running from a logical place, e.g., showing this progress or allowing the Script to be cancelled for an 'Object Events' type Script could cause issues.