Skip to content

piPosition - cProgressBar

The current position of the progress within the progress bar

Type: Property
Access: Read/Write
Data Type: Integer
Parameters: None

Syntax

Property Integer piPosition
Access Type Syntax
Read Access: Get piPosition to IntegerVariable
Write Access: Set piPosition to IntegerVariable/Value

Description

piPosition is the current position of the progress within the progress bar. When you set this value, the progress bar will redraw the bar to reflect the change.

Sample

This sample shows you might open a file for sequential I/O and use the file's size to determine the maximim progress bar setting, so that the progress bar can be updated with the number of bytes read while the file's data is being read.

Object oProgressBar1 is a cProgressBar
    Set Size to 14 100
    Set Location to 45 40
    Set piMinimum to 0
End_Object

Object oReadButton is a Button
    Set Location to 118 37
    Set Label to "FileSize"

    Procedure ReadFile channel iChIn
        String sFileName
        Integer iSize iCurrentLocation

        Set piMinimum of oProgressBar1 to 0  // this sets piPosition to 0, as well

        Get Value of oFileNameForm to sFileName
        Direct_Input channel iChIn sFileName

        // set max position to channel size
        Get_Channel_Size iChIn to iSize
        Set piMaximum of oProgressBar1 to iSize
        ...
        While not [seqeof]
            Readln Channel iChIn sLine

            // update current progress bar position
            Get_Channel_Location iChIn to iCurrentLocation
            Set piPosition oProgressBar1 to iCurrentLocation
        Loop

        Close_Input Channel iChIn
    End_Procedure    
End_Object

See Also

piMinimum | piMaximum | Sequential File Input and Output