(VFP) - How to insert simple Progress Bar
**************************************************
** The following shows Records for progress bar **
**************************************************
** Create By : Leosan **
** Date Create : 22-12-2004 Time 08.00 am **
** Class Name : ProgressingBar **
** Form : ProgressingBar **
** ParentClass : form **
** BaseClass : form **
** Time Stamp : 22/12/2004 08:09:04 AM **
**************************************************
DEFINE CLASS ProgressingBar AS form
Height = 70
Width = 408
AutoCenter = .T.
BackColor = RGB(240,240,240)
BorderStyle = 3
Caption = ""
Closable = .F.
ControlBox = .F.
MaxButton = .F.
MinButton = .F.
Movable = .F.
AlwaysOnTop = .f.
ShowWindow = 1
Name = "ProgressBar"
ADD OBJECT shape1 AS shape WITH ;
Curvature = 10, ;
Top = 6, ;
Left = 6, ;
Height = 58, ;
Width = 396, ;
Name = "Shape1"
ADD OBJECT lblProgress AS label WITH ;
BackStyle = 0, ;
Caption = "Progress", ;
ForeColor = RGB(0,0,128), ;
Height = 14, ;
Left = 12, ;
Top = 12, ;
Width = 384, ;
Name = "lblProgress"
ADD OBJECT Progress AS textbox WITH ;
Value = 1, ;
Visible = .F., ;
Name = "Progress"
ADD OBJECT ProgressBarBack AS Container WITH ;
SpecialEffect = 1, ;
Top = 29, ;
Left = 12, ;
Height = 24, ;
Width = 384, ;
Name = "ProgressBarBack"
ADD OBJECT ProgressBar AS container WITH ;
BackColor = RGB(224,192,0), ;
BackStyle = 1, ;
BorderWidth = 0, ;
Top = 31, ;
Left = 14, ;
Height = 20, ;
Width = 380, ;
Name = "ProgressBar"
ADD OBJECT ProgressPercent AS Label WITH ;
BackStyle = 0, ;
BorderStyle = 0, ;
FontItalic = .t., ;
FontSize = 9, ;
ForeColor = RGB(0,0,128), ;
Top = 34, ;
Left = 192, ;
Height = 18, ;
Width = 36, ;
Name = "ProgressPercent"
PROCEDURE Destroy
SET CURSOR ON
ENDPROC
PROCEDURE Init
* Simply Set This.Progress1.Value = % completed to display suitably.
This.Progress.Value = 0
SET CURSOR OFF
This.zOrder(0)
INKEY(0.001)
ENDPROC
PROCEDURE progress.ProgrammaticChange
* 380 is the Max width of the Progress Bar when 100% completed.
rec_done = (this.value / m_len)
bar_done = rec_done * 100
scl_bar = rec_done * 380
percent_done = TRANSFORM(bar_done, '999')
This.Parent.ProgressBar.Width = scl_bar
This.Parent.ProgressPercent.Caption = percent_done+'%'
INKEY(0.001)
ENDPROC
ENDDEFINE
*
*-- EndDefine: ProgressingBar
**************************************************
** The following shows Records for progress bar **
**************************************************
** Create By : Leosan **
** Date Create : 22-12-2004 Time 08.00 am **
** Class Name : ProgressingBar **
** Form : ProgressingBar **
** ParentClass : form **
** BaseClass : form **
** Time Stamp : 22/12/2004 08:09:04 AM **
**************************************************
DEFINE CLASS ProgressingBar AS form
Height = 70
Width = 408
AutoCenter = .T.
BackColor = RGB(240,240,240)
BorderStyle = 3
Caption = ""
Closable = .F.
ControlBox = .F.
MaxButton = .F.
MinButton = .F.
Movable = .F.
AlwaysOnTop = .f.
ShowWindow = 1
Name = "ProgressBar"
ADD OBJECT shape1 AS shape WITH ;
Curvature = 10, ;
Top = 6, ;
Left = 6, ;
Height = 58, ;
Width = 396, ;
Name = "Shape1"
ADD OBJECT lblProgress AS label WITH ;
BackStyle = 0, ;
Caption = "Progress", ;
ForeColor = RGB(0,0,128), ;
Height = 14, ;
Left = 12, ;
Top = 12, ;
Width = 384, ;
Name = "lblProgress"
ADD OBJECT Progress AS textbox WITH ;
Value = 1, ;
Visible = .F., ;
Name = "Progress"
ADD OBJECT ProgressBarBack AS Container WITH ;
SpecialEffect = 1, ;
Top = 29, ;
Left = 12, ;
Height = 24, ;
Width = 384, ;
Name = "ProgressBarBack"
ADD OBJECT ProgressBar AS container WITH ;
BackColor = RGB(224,192,0), ;
BackStyle = 1, ;
BorderWidth = 0, ;
Top = 31, ;
Left = 14, ;
Height = 20, ;
Width = 380, ;
Name = "ProgressBar"
ADD OBJECT ProgressPercent AS Label WITH ;
BackStyle = 0, ;
BorderStyle = 0, ;
FontItalic = .t., ;
FontSize = 9, ;
ForeColor = RGB(0,0,128), ;
Top = 34, ;
Left = 192, ;
Height = 18, ;
Width = 36, ;
Name = "ProgressPercent"
PROCEDURE Destroy
SET CURSOR ON
ENDPROC
PROCEDURE Init
* Simply Set This.Progress1.Value = % completed to display suitably.
This.Progress.Value = 0
SET CURSOR OFF
This.zOrder(0)
INKEY(0.001)
ENDPROC
PROCEDURE progress.ProgrammaticChange
* 380 is the Max width of the Progress Bar when 100% completed.
rec_done = (this.value / m_len)
bar_done = rec_done * 100
scl_bar = rec_done * 380
percent_done = TRANSFORM(bar_done, '999')
This.Parent.ProgressBar.Width = scl_bar
This.Parent.ProgressPercent.Caption = percent_done+'%'
INKEY(0.001)
ENDPROC
ENDDEFINE
*
*-- EndDefine: ProgressingBar
**************************************************
Comments