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.
Use UIToolkit::GetProgressBar to create a progress bar. The default minimum and maximum is between 0 and 100 with a step of 1.
using namespace XSI; Application app; UIToolkit kit = app.GetUIToolkit(); ProgressBar bar = kit.GetProgressBar(); bar.PutMaximum( 50000 ); bar.PutStep( 10 ); bar.PutVisible( true ); bar.PutCaption( L"Processing" ); while (!bar.IsCancelPressed() && bar.GetValue() < bar.GetMaximum() ) { CValue newVal(bar.Increment()); bar.PutStatusText( L"Frame " + newVal.GetAsText() ); }
#include <xsi_progressbar.h>
Public Member Functions | |
ProgressBar () | |
~ProgressBar () | |
ProgressBar (const CRef &in_ref) | |
ProgressBar (const ProgressBar &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
ProgressBar & | operator= (const ProgressBar &in_obj) |
ProgressBar & | operator= (const CRef &in_ref) |
LONG | GetMaximum () const |
CStatus | PutMaximum (LONG in_val) |
LONG | GetMinimum () const |
CStatus | PutMinimum (LONG in_val) |
LONG | GetStep () const |
CStatus | PutStep (LONG in_step) |
LONG | GetValue () const |
CStatus | PutValue (LONG in_val) |
CString | GetCaption () const |
CStatus | PutCaption (const CString &in_str) |
CString | GetStatusText () const |
CStatus | PutStatusText (const CString &in_str) |
bool | GetVisible () const |
CStatus | PutVisible (bool in_flag) |
bool | IsCancelPressed () const |
LONG | Increment (LONG in_val=1) |
CStatus | PutCancelEnabled (bool in_bEnable) |
bool | IsCancelEnabled () const |
ProgressBar | ( | ) |
Default constructor.
~ProgressBar | ( | ) |
Default destructor.
ProgressBar | ( | const CRef & | in_ref | ) |
Constructor.
in_ref | constant reference object. |
ProgressBar | ( | const ProgressBar & | in_obj | ) |
Copy constructor.
in_obj | constant class object. |
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from CBase.
siClassID GetClassID | ( | ) | const [virtual] |
ProgressBar& operator= | ( | const ProgressBar & | in_obj | ) |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
ProgressBar& operator= | ( | const CRef & | in_ref | ) |
Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.
in_ref | constant class object. |
LONG GetMaximum | ( | ) | const |
Returns the upper limit of the progress bar's range. The default value is 100.
CStatus PutMaximum | ( | LONG | in_val | ) |
Sets the upper limit of the progress bar's range.
in_val | The maximum value to be set for the progress bar. Attempting to set the maximum value to be less than the minimum value will result in an "invalid argument" error. |
LONG GetMinimum | ( | ) | const |
Returns the lower limit of the progress bar's range. The default value is 0.
CStatus PutMinimum | ( | LONG | in_val | ) |
Sets the lower limit of the progress bar's range.
in_val | The minimum value to be set for the progress bar. Attempting to set the minimum value to be greater than the maximum value will result in an "invalid argument" error. |
LONG GetStep | ( | ) | const |
Returns the step value for the progress bar. The default value is 0.
CStatus PutStep | ( | LONG | in_step | ) |
Sets the step value, which is the amount the progress bar will be incremented per increment step.
in_step | The increment amount to be set for an increment step of the progress bar. Attempting to set the step value to be greater than the maximum value or a negative value will result in an "invalid argument" error. |
LONG GetValue | ( | ) | const |
Returns the value of the progress bar. The default value is 0.
CStatus PutValue | ( | LONG | in_val | ) |
Updates the value of the progress bar. If the visibility is set to true the ProgressBar is redrawn to reflect the new position.
in_val | Attempting to set the value to be greater than the maximum value will result in an "invalid argument" error. |
CString GetCaption | ( | ) | const |
Returns the caption to be displayed during incrementation.
Sets the caption to be displayed as the progress bar increments.
in_str | Text to display in the caption. |
CString GetStatusText | ( | ) | const |
Returns the status text to be displayed as the progress bar increments.
Sets the status text to be displayed during incrementation.
in_str | Test to display. |
bool GetVisible | ( | ) | const |
Returns the visibility state for the progress bar.
CStatus PutVisible | ( | bool | in_flag | ) |
Sets the visibility of the progress bar. Use this property to make the progress bar appear or disappear on the screen.
in_flag | Display the progress bar if true or hide it if false. |
bool IsCancelPressed | ( | ) | const |
Returns true if the Cancel button on the progress bar has been clicked.
LONG Increment | ( | LONG | in_val = 1 | ) |
Advances the current position for the progress bar control by the specified number of steps. If the visibility is set to true the progress bar is redrawn to reflect the new position.
in_val | The amount to increment the current value. |
CStatus PutCancelEnabled | ( | bool | in_bEnable | ) |
Provides control over whether the progress bar will have a working Cancel button or not. By default the Cancel button is enabled. For operations that cannot be stopped part way through it is good UI design to disable the Cancel button.
in_bEnable | True to enable the Cancel button |
bool IsCancelEnabled | ( | ) | const |
Returns true when the Cancel button on the progress bar is enabled