Progress

Note

Progress is derived from Control class.

A Progress is a horizontal or vertical bar which shows a quantity (often time).

Progressbar supports two working modes: determinate and indeterminate progress.

The first is the usual working mode (see setCurrentPos and setMaxValue) while the second can be used when the program is doing some processing but you don’t know how much progress is being done. In this case, you can periodically call the Pulse function to make the progressbar switch to indeterminate mode (graphically it’s usually a set of blocks which move or bounce in the bar control).


Constructor

Progress class has a complex constructor:

object Progress:new {
               string Name, object Parent
       }

Events

The following events are emitted by this class:

Event name Description
Widget.onEnter When the mouse moves onto this widget.
Widget.onLeave When the mouse moves out to this widget.

Inherited Methods

These methods are inherited from its super classes:

Class Method Description
Object:getName Returns object’s name.
Object:setName Sets the object name.
Widget:getParent Returns object’s parent.
Widget:setParent Sets the object parent.
Widget:getPosX Returns object’s position related to X.
Widget:setPosX Sets the object position related to X.
Widget:getPosY Returns object’s position related to Y.
Widget:setPosY Sets the object position related to Y.
Widget:getWidth Returns object’s width.
Widget:setWidth Sets the object width.
Widget:getHeight Returns object’s height.
Widget:setHeight Sets the object height.
Widget:getwxObj Returns the wxWidgets object.

Progress:setCurrentPos

This method helps to set the current position of the progress bar. This function makes the progressbar switch to determinate mode, if it’s not already.
bool Progress:setCurrentPos ( number nPercent )

Progress:getCurrentPos

Gets the current position of progress bar.
number Progress:setCurrentPos( number nPosition )

Progress:isVertical

Returns true if the progressbar is vertical and false otherwise.
boolean_ Progress:isVertical()

Progress:setMaxValue

Sets the range (maximum value) of the progressbar. This function makes the progressbar switch to determinate mode, if it’s not already.
nil Progress:setMaxValue( number nMaxValue )

Progress:pulse

Switch the progressbar to indeterminate mode (if required) and makes the progressbar move a bit to indicate the user that some progress has been made.

Note that after calling this function the value returned by ``getCurrentPos`` is undefined and thus you need to explicitely call ``setCurrentPos`` if you want to restore the determinate mode.

nil Progress:pulse( )

Progress:getMaxValue

Returns the maximum position of the progressbar.
number Progress:getMaxValue( )