Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create completed % status bar during copying file
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00496067
Message ID:
00496073
Views:
11
>I have to convert some long text files to VFP tables by small program. It takes about 15 minuts to complete the process (about 51,000 records). I want to make a form which should tell me the progress of work. Like we see the blue status bar during installation of most softwares.
>
>
>Thanks
>
Zaheer,

VFP ships with an ActiveX progress bar that's very easy to use. It does not, however, show percentage complete. Back in VFP 5.0, I wrote one that does. The following is the code generated from the class browser:
**************************************************
*-- Class:        indtherm (c:\program files\microsoft visual studio\vfp98\ida\imp_exp\imp_exp.vcx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   08/17/99 11:14:14 AM
*
DEFINE CLASS indtherm AS form


	Height = 87
	Width = 328
	Desktop = .T.
	ShowWindow = 1
	DoCreate = .T.
	AutoCenter = .T.
	Caption = ""
	ControlBox = .F.
	Closable = .F.
	MaxButton = .F.
	MinButton = .F.
	Movable = .F.
	Name = "indtherm"

	*-- Denominator for percent calculation
	n_denominator = 0

	ADD OBJECT backshape AS shape WITH ;
		Top = 32, ;
		Left = 14, ;
		Height = 34, ;
		Width = 300, ;
		BackStyle = 1, ;
		BorderStyle = 0, ;
		BackColor = RGB(255,255,255), ;
		Name = "Backshape"


	ADD OBJECT label1 AS label WITH ;
		FontBold = .T., ;
		FontName = "MS Sans Serif", ;
		Alignment = 2, ;
		Caption = "Label1", ;
		Height = 18, ;
		Left = 116, ;
		Top = 41, ;
		Width = 93, ;
		TabIndex = 2, ;
		ForeColor = RGB(0,0,255), ;
		BackColor = RGB(255,255,255), ;
		Name = "Label1"


	ADD OBJECT foreshape AS shape WITH ;
		Top = 33, ;
		Left = 14, ;
		Height = 32, ;
		Width = 0, ;
		BackStyle = 0, ;
		BorderStyle = 0, ;
		DrawMode = 10, ;
		FillStyle = 0, ;
		BackColor = RGB(255,255,255), ;
		FillColor = RGB(0,0,255), ;
		Name = "ForeShape"


	ADD OBJECT text1 AS textbox WITH ;
		BackStyle = 0, ;
		Height = 38, ;
		Left = 11, ;
		Top = 29, ;
		Width = 304, ;
		Name = "Text1"


	ADD OBJECT label2 AS label WITH ;
		AutoSize = .T., ;
		FontName = "MS Sans Serif", ;
		FontSize = 8, ;
		Caption = "Processing...", ;
		Height = 15, ;
		Left = 13, ;
		Top = 7, ;
		Width = 63, ;
		Name = "Label2"


	*-- Updates thermometer
	PROCEDURE updatetherm
		LPARAMETER p_newnumer

		LOCAL n_pct, n_barwidth
		n_pct = (p_newnumer / Thisform.n_denominator)
		n_barwidth = INT(300 * n_pct)
		Thisform.ForeShape.Width = n_barwidth
		Thisform.Label1.Caption = TRANSFORM(ROUND(n_pct * 100, 0), '###%')
		Thisform.Refresh
	ENDPROC


	PROCEDURE Init
		LPARAMETERS pn_denom, pc_msg
		LOCAL n_args
		n_args = PCOUNT()
		This.Label1.Caption = '0%'
		Thisform.n_denominator = pn_denom
		IF n_args = 2
		  Thisform.Label2.Caption = pc_msg
		ENDIF
	ENDPROC


ENDDEFINE
*
*-- EndDefine: indtherm
**************************************************
This is designed for use with a top-level form. With some minor modifications, it could be used anywhere.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform