ShowProgressBar
ShowProgressBar(title, text, p)
Declaration:
- ShowProgressBar(title, text: Text atomic; p: number atomic)
Description
Displays or updates a programmable dialog containing a progress bar. The «p» parameter denotes "percent complete" of a computation in progress. The first time it is called with «p» < 1, the dialog appears. When 0 ≤ «p» < 1, a Cancel button is displayed and the progress meter is updated to the indicated proportion, allowing computation to continue while it is visible. If the user presses Cancel, the computation is aborted. When «p» = 1, an OK button is shown and the dialog waits until OK is pressed to return and then disappears. The dialog is also removed when «p» > 1 or a computation completes.
Example
Var xOrig := X;
Var result :=
for n[] := @Scenario do (
ShowProgressBar("Progress", "Computing Across All Scenarios", (n - 1)/size(scenario));
WhatIf(Y, X, xOrig[@Scenario = n])
);
ShowProgressBar("Progress", "Done", 1);
result
You can use a progress bar to track your progress through a Dynamic computation:
Dynamic(initial_population,
(ShowProgressBar( "Progress", "Computing a dynamic model, Time = " & Time, (@Time - 1)/size(Time));
population[Time - 1] + births[Time - 1] - deaths[Time - 1] + net_immigration[Time - 1]))
You may find it helpful to show percent completion of the computation. You might use a User-Defined Function:
ShowProgressBar("Progress", "Calculation is " & NumberToText(p, "Percent", 0) & " complete", p)
where p
is your measure of percent complete.
Analytica Cloud Platform and ADE
The progress bar works in Analytica Cloud Platform.
When evaluated from in the Analytica Decision Engine (ADE), it calls IAdeUICallbacks::ShowProgressBar(...). From within that callback, the parent application can display a progress bar or other feedback to the end-user. To receive the callback, the parent application must have previously registered the callback with ADE using CAEngine::SetCallbackObject( ). If it has not registered a callback, then ShowProgressBar from ADE does nothing.
See Also
- MsgBox
- When using ADE: IAdeUICallbacks::ShowProgressBar and IAdeUICallbacks::HideProgressBar methods
- Creating Interfaces for End Users
Enable comment auto-refresher