ProgressBar

Object Hierarchy | Related C++ Class: ProgressBar

Introduced

v3.0

Description

A progress bar is a control that indicates the progress of a lengthy operation by displaying a colored bar inside a horizontal rectangle. The length of the bar, in relation to the length of the rectangle, corresponds to the percentage of the operation that is complete. The progress bar can be created using the XSIUIToolkit.ProgressBar property. The default minimum and maximum is between 0 and 100 with a step of 1.

Warning: When using the ProgressBar from JScript you must explicitly set the Visible property to false when the script is done with it. In other languages the ProgressBar automatically removes itself from the screen as soon as all local variables referring to the ProgressBar object go out of scope.

Note: A progress bar should only be updated a few times a second. If is updated more frequently it can potentially slow down the script execution. For example, an algorithm scanning 1,000,000 vectors would be slowed considerably if it updated a progress bar for each vector.

Methods

Increment      
       

Properties

CancelEnabled CancelPressed Caption Maximum
Minimum StatusText Step Value
Visible      
       

Examples

1. JScript Example

/*
        Demonstrates how to properly finish with the progress bar. 
*/
var oProgressBar = XSIUIToolkit.ProgressBar ;
oProgressBar.Maximum = 100 ;
oProgressBar.Step = 1;
oProgressBar.Caption = "Creating Nulls";
oProgressBar.CancelEnabled = true ;
oProgressBar.Visible = true;
while( oProgressBar.Value < oProgressBar.Maximum )
{
        Application.ActiveSceneRoot.AddNull() ;
        if ( oProgressBar.CancelPressed )
                break ;
        oProgressBar.Increment() ;
}
// Make sure the progress bar disappears
oProgressBar.Visible = false ;

2. VBScript Example

'
' Demonstrates the use of the progress bar in displaying percentage complete. 
'
dim oProgressBar
set oProgressBar = XSIUIToolkit.ProgressBar
oProgressBar.Maximum = 65535
oProgressBar.Step = 10
oProgressBar.CancelEnabled = true
oProgressBar.Caption = "Processing"
oProgressBar.Visible= true
Do While oProgressBar.CancelPressed<>True And oProgressBar.Value < oProgressBar.Maximum
        oProgressBar.Increment
Loop

3. VBScript Example

'
' Demonstrates the use of the progress bar in displaying progress per frame. 
'
dim oProgressBar
set oProgressBar = XSIUIToolkit.ProgressBar
oProgressBar.Maximum = 65535
oProgressBar.Visible= true
Do While oProgressBar.CancelPressed<>True And oProgressBar.Value < oProgressBar.Maximum
        i = oProgressBar.Increment
        oProgressBar.StatusText = "Frame " & i
Loop

See Also

XSIUIToolkit.ProgressBar