Setting and displaying a progress bar value

SetProgressPosition()

Set and display a progress bar value


SYNTAX

SetProgressPosition(graphic_id [ , value] )

Set the value of a progress bar type graphic and display it. The graphic is defined as +|- graphic graphic_id, and must be allocated the type clause GT_PROGRESS.

The value should be an integer in the range defined for the progress bar. The range is defined by the SetProgressRange() function, defaulting to 0-100. The default for value is 0.

A progress bar’s 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 window procedure uses the range and the current position to determine the percentage of the progress bar to fill with the highlight colour.

The value is displayed by means of blocks in the progress bar, normally filling it from left to right as the task being displayed proceeds. Each block represents 5% of the total range. A value below the minimum value in the range causes the progress bar to clear; a value above the highest in the range causes the bar to fill completely.

The demo program $SCULPTOR\demo\misc\progress.f provides an example of progress bar use.


Note

Because the range and current position values are expressed as unsigned integers, the highest possible current position value is 65,535. This is a limitation imposed by Microsoft.


EXAMPLE

!temp Count,,u2

     +graphic ProgBar1 at 9,1 {
          type = GT_PROGRESS
     }

     setcursor(wintask, CURSOR_WAIT)

     for (Count = 10; Count <= 100; Count = Count + 10) {
          SetProgressPosition(wintask.ProgBar1, Count)
          SetProgressPosition(wintask.ProgBar2, Count)
          SetProgressPosition(wintask.ProgBar3, Count * 2)
          sleep 1
     }

     setcursor(wintask, CURSOR_ARROW)

RELATED TOPICS

SetProgressRange()

Graphics

Progress bars