ShowProgressBar(title, text, p)


ShowProgressBar(title, text: Text atomic; p: number atomic)


Displays a dialog with a progress bar. It's a great idea to show a progress bar whenever a calculation may take more than a few seconds so that the end user doesn't worry that the application has got stuck, and, where possible, to give her an idea of how much longer it may take. The «p» parameter denotes "percent complete" of the computation in progress as shown by the bar width. It should be in the range 0 ≤ «p» ≤1. If «p» < 1 it shows a Cancel button to let the user Cancel further computation. When «p» = 1, it shows an OK button. The dialog disappears when you click OK or «p» > 1, or the computation completes without updating the progress bar.

You can use the «text» parameter to indicate progress -- e.g. the name of a file being read, or scenario being computed.


Var xOrig := X;
Var result :=
for n[] := @Scenario do (
ShowProgressBar("Progress", "Computing scenario "&Scenario, (n - 1)/size(Scenario));
WhatIf(Y, X, xOrig[@Scenario = n])
ShowProgressBar("Progress", "Done", 1);

You can use a progress bar to track your progress through a Dynamic computation:

(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


You are not allowed to post comments.