Original documentation component by D.Glodt (c)2000-2001, modified by John Kelly Appendix A: QProgress

QProgress Component

QProgress is an extended form that simplifies a QGauge, or shows a graphic that  the program is busy. Used visually to give users the progress of an operation or let them know the program is busy. If  Kind is gkMovingDot, gkmovingRect, gkmovingBlur, or gkBarberPole then QProgress uses background tasking to make a moving marquee in the progress bar.

QProgress Properties
Field Type R/W Défault





BackColor INTEGER RW 0
Color INTEGER     (Foreground Color) RW Form.Color
Gauge QGauge   (see QGauge documentation) RW
Handle INTEGER RW
Height INTEGER RW
Interval Update interval for moving graphics operating in the background RW
Kind INTEGER RW
If  Kind is a QGauge type  (gkText = 0, gkHorizontalBar = 1, gkVerticalBar = 2, gkPie = 3, gkNeedle = 4)
then it appears just like a QGauge. If Kind = gkMovingDot, gkmovingRect, gkmovingBlur, or gkBarberPole )
then a custom moving graphic is shown in the background during calculations (if allowed),
gkMovingDot = 4
gkmovingRect = 5
gkmovingBlur = 6
gkBarberPole = 7
Left INTEGER RW 0
Parent Handle QFORM/QPANEL/QTABCONTROL RW
Range INTEGER     (integer Range i.e., 100 for 100%) RW 0
StepSize INTEGER    (sets the speed of the custom moving graphic) RW 0
Top INTEGER RW 0
Width INTEGER RW
UseThreading INTEGER RW False
Updates the progress bar with a backgroung Thread. Caution, RapidQ may not be thread safe. 
It requires that you don't also use CODEPTR(SUB ...) anywhere in your code!
Visible INTEGER RW True
Visible will turn it on or off 
Value INTEGER RW
Progress value in percent (0 - 100) 

QProgress Methods
Method Type Description Params





QProgress Events
Event Type Occurs when... Params





QProgress Examples

$TYPECHECK ON
$INCLUDE <Rapidq.inc>
$INCLUDE <QProgress.inc>
Declare Sub Display 

CREATE Form AS QFORM 
    Caption = "Progress Bar" 
    Width = 350 
    Height = 90 
    top = 50
    left = 50
    CREATE Bar AS QProgress
        Kind = gkBarberpole
        Color = RGB(0, 220, 0) 'green
        Width = Form.Width
        Height = 20
        Parent=form.handle     'set to a widget/form this way
    END CREATE
    CREATE Button1 AS QBUTTON 
        Caption = "Activate!" 
        Left = 125 
        Top = 30 
        OnClick=Display
    END CREATE 
END CREATE 

Form.ShowModal 


Sub Display 
    DIM i as integer, y as integer

    if bar.visible = False THEN 
        Button1.Caption = "Calculating"
        bar.visible = true
        'do your  calculations
          for i = 1 to 80000
             DoEvents   'must do this if UseThreading = false
             y= i\2
          next i
        bar.visible = false
        Showmessage "Calc done, y = " + Str$(y)
        Button1.Caption = "Activate"
    end if
END SUB 

 

QProgress Example #2

$TYPECHECK ON
$INCLUDE <Rapidq.inc>
$INCLUDE <QProgress.inc>
Declare Sub Display 

CREATE Form AS QFORM 
    Caption = "Progress Bar" 
    Width = 350 
    Height = 90 
    top = 50
    left = 50
    CREATE Bar AS QProgress
        Kind = gkHorizontalBar 
        Width = Form.Width
        Height = 20
        Parent=form.handle
    END CREATE
    CREATE Button1 AS QBUTTON 
        Caption = "Increment" 
        Left = 125 
        Top = 30 
        OnClick=Display
    END CREATE 
END CREATE 

Form.ShowModal 

Sub Display 
    Static pourcent as integer
    IF Bar.Visible = False THEN Bar.Visible = True
     IF pourcent<100 THEN 
         pourcent=pourcent + 1
         Bar.Value=pourcent 
     END IF   
END SUB