Below is the sample code how would I edit this exact code to close dialog1 once the progress bar is full without having to click a modal button? Any suggestions are welcome.



Code: Select all
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>LOADINGPOS=intMin
Let>ProgressFlag=0
Show>Dialog1,res1
MessageModal>WAITING FOR NEXT DIALOG TO OPEN
SRT>DoProgress
SetDialogProperty>Dialog1,btnStart,Enabled,False
If>ProgressFlag=0
Let>LOADINGPOS=intMin
EndIf
Repeat>LOADINGPOS
Let>LOADINGPOS=LOADINGPOS+10
SetDialogProperty>Dialog1,ProgressBar1,Position,LOADINGPOS
If>ProgressFlag>1
Goto>EndProgress
EndIf
Wait>0.05
Until>LOADINGPOS=intMax
Label>EndProgress
SetDialogProperty>Dialog1,btnStart,Enabled,True
Let>ModalResult=2
END>DoProgress
SRT>DoReset
Let>LOADINGPOS=intMin
SetDialogProperty>Dialog1,ProgressBar1,Position,LOADINGPOS
END>DoReset
SRT>DoStop
Let>ProgressFlag=2
SetDialogProperty>Dialog1,ProgressBar1,Position,LOADINGPOS
END>DoStop
SRT>DoClose
Let>LOADINGPOS=intMax
END>DoClose