Chapter 22. ProgressBar Class

Table of Contents
step
setPos
getPos
setStep
setRange
getRange
setMarquee
barColor
backgroundColor

A progress bar is a control that an application can use to indicate the progress of a lengthy operation. It consists of a rectangle that is gradually filled, from left to right or from bottom to top, with the system highlight color as an operation progresses. It has a range and a current position. The range represents the entire duration of the operation, and the current position represents the progress that the application has made toward completing the operation.

The underlying Windows progress bar control has been updated to allow a full 32-bit number to specify the minimum and maximum range and current position. Previously, the highest possible range or current position value wass 65,535. The range is now -2147483648 through 2147483647.

Some sample programs included in the ooRexx distribution have examples of how to use the progress bar control. See for instance: oodPBar.rex and propDemo.rex in the samples\ooDialog directory.

Requires:

The ProgressBar class requires the class definition file oodWin32.cls:

::requires "oodWin32.cls"

Subclass of:

The progress bar class is a subclass of the DialogControl class and therefore inherits all methods of that class.

Mixin Class Inherits:

The progress bar class inherits from the following mixin classes, (indirectly through the DialogControl class.)

The WindowBase

The WindowExtensions

Instantiation:

Use the getProgressBar() method to retrieve an object of the progress bar class.

Dynamic Definition:

To dynamically define a progress bar in a UserDialog class, use the addProgressBar() method.

Event Notification

The progress bar does not send notification messages.

Syntax Errors:

All methods of the progress bar class will raise syntax errors if incorrect arguments are detected.

Methods:

Instances of the ProgressBar class implement the methods listed in the following table.

Table 22-1. ProgressBar Instance Methods

Method......Description
backgroundColorbackgroundColor
barColorbarColor
getPosgetPos
getRangegetRange
setMarqueesetMarquee
setPossetPos
setRangesetRange
setStepsetStep
stepstep

step

>>--step(--+-----------+--)---------------------><
           +-increment-+


The step method advances the current position of the progress bar. If increment is specified, the current position is incremented by that amount. If not specified, the current position is incremented by the amount set with the setStep() method. The progress bar is redrawn to reflect the new position.

There is this important difference between using an increment, usually called a delta, and stepping by the amount specified in the setStep() method. When an increment is used and the increment would position the the progress bar past its maximum range, the progress bar is advanced to the end and stays there.

On the other hand, when the default step is used and the progress bar reaches the end of its range, it is reset to the minimum.

Details

Raises syntax errors when incorrect arguments are detected.

Arguments:

The single optional argument is the amount to advance the current position. If this argument is not used, the position is advanced by the value set with the setStep method.

Return value:

The previous position.