Dialog>Dialog1
object Dialog1: TForm
  Left = 576
  Top = 266
  HelpContext = 5000
  BorderIcons = [biSystemMenu]
  Caption = 'Progress Bar Example'
  ClientHeight = 116
  ClientWidth = 439
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = True
  ShowHint = True
  OnTaskBar = False
  PixelsPerInch = 96
  TextHeight = 13
  object ProgressBar1: TProgressBar
    Left = 18
    Top = 17
    Width = 399
    Height = 17
    TabOrder = 8
  end
  object btnStart: tMSButton
    Left = 24
    Top = 56
    Width = 75
    Height = 25
    Caption = 'Start'
    DoubleBuffered = True
    ParentDoubleBuffered = False
    TabOrder = 9
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object btnStop: tMSButton
    Left = 128
    Top = 56
    Width = 75
    Height = 25
    Caption = 'Stop'
    DoubleBuffered = True
    ParentDoubleBuffered = False
    TabOrder = 10
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object btnReset: tMSButton
    Left = 232
    Top = 56
    Width = 75
    Height = 25
    Caption = 'Reset'
    DoubleBuffered = True
    ParentDoubleBuffered = False
    TabOrder = 11
    DoBrowse = False
    BrowseStyle = fbOpen
  end
  object btnClose: tMSButton
    Left = 344
    Top = 56
    Width = 75
    Height = 25
    Caption = 'Close'
    DoubleBuffered = True
    ModalResult = 2
    ParentDoubleBuffered = False
    TabOrder = 12
    DoBrowse = False
    BrowseStyle = fbOpen
  end
end
EndDialog>Dialog1

AddDialogHandler>Dialog1,btnStart,OnClick,DoProgress
AddDialogHandler>Dialog1,btnStop,OnClick,DoStop
AddDialogHandler>Dialog1,btnReset,OnClick,DoReset
AddDialogHandler>Dialog1,btnClose,OnClick,DoClose

GetDialogProperty>Dialog1,ProgressBar1,Min,intMin
GetDialogProperty>Dialog1,ProgressBar1,Max,intMax
Let>kk=intMin
Let>ProgressFlag=0

Show>Dialog1,res1


SRT>DoProgress
  SetDialogProperty>Dialog1,btnStart,Enabled,False
  If>ProgressFlag=0
    Let>kk=intMin
  EndIf
  Repeat>kk
    Let>kk=kk+1
    SetDialogProperty>Dialog1,ProgressBar1,Position,kk
    If>ProgressFlag>1
      Goto>EndProgress
    EndIf
    Wait>0.05
  Until>kk=intMax
  Label>EndProgress
  SetDialogProperty>Dialog1,btnStart,Enabled,True
  Let>ProgressFlag=1
END>DoProgress

SRT>DoReset
  Let>kk=intMin
  SetDialogProperty>Dialog1,ProgressBar1,Position,kk
END>DoReset

SRT>DoStop
  Let>ProgressFlag=2
  SetDialogProperty>Dialog1,ProgressBar1,Position,kk
END>DoStop

SRT>DoClose
  Let>kk=intMax
END>DoClose