Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Progress bar
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01139801
Message ID:
01139977
Vues:
14
>Hi , is there any progress bar in VFP
>
>thanks

Shlomo,

VFP is really powerfull. It is actually fairly easy to write a progress bar. Below is what I wrote:
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1 
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   07/25/06 05:00:06 PM
*
DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	Height = 123
	Width = 420
	DoCreate = .T.
	Caption = "Form1"

	Name = "Form1"


	ADD OBJECT cprogressbar1 AS cprogressbar WITH ;
		Anchor = 10, ;
		Top = 22, ;
		Left = 11, ;
		Name = "Cprogressbar1", ;
		lbPercentage.Name = "lbPercentage", ;
		shapeProgress.Name = "shapeProgress"


	ADD OBJECT progress AS commandbutton WITH ;
		Top = 66, ;
		Left = 149, ;
		Height = 27, ;
		Width = 121, ;
		Anchor = 160, ;
		Caption = "Go", ;
		Name = "Progress"


	PROCEDURE Load
		DECLARE Integer Sleep IN WIN32API integer 
	ENDPROC


	PROCEDURE progress.Click
		LOCAL i
		FOR i = 0 TO 100
		thisform.cprogressbar1.Updateprogress(i)
		thisform.Draw()
		Sleep(100)
		NEXT 
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************

**************************************************
*-- Class:        
*-- ParentClass:  container
*-- BaseClass:    container
*-- Time Stamp:   07/25/06 05:03:10 PM
*
DEFINE CLASS cprogressbar AS container


	Width = 401
	Height = 21
	SpecialEffect = 1
	BackColor = RGB(0,128,255)
	Style = 0

	Name = "cprogressbar"


	ADD OBJECT shapeprogress AS shape WITH ;
		Top = 2, ;
		Left = 2, ;
		Height = 17, ;
		Width = 0, ;
		DrawMode = 7, ;
		FillStyle = 0, ;
		FillColor = RGB(255,255,0), ;
		Name = "shapeProgress"


	ADD OBJECT lbpercentage AS label WITH ;
		FontBold = .T., ;
		FontName = "Verdana", ;
		FontSize = 8, ;
		Anchor = 768, ;
		Alignment = 2, ;
		BackStyle = 0, ;
		Caption = "0%", ;
		Height = 17, ;
		Left = 180, ;
		Top = 2, ;
		Width = 40, ;
		ForeColor = RGB(0,232,232), ;
		Name = "lbPercentage"


	PROCEDURE UpdateProgress
		LPARAMETERS lpnPercentage

		IF BETWEEN(m.lpnPercentage,0,100) ;
		THEN 
			this.shapeProgress.Width = m.lpnPercentage/100*(this.Width-4)
			this.lbPercentage.Caption = TRANSFORM(m.lpnPercentage)+"%"
		ENDIF 
	ENDPROC


	*-- Resets the control so that it starts counting from 0.
	PROCEDURE reset
		this.shapeProgress.Width = 0
		this.lbPercentage.Caption = "0%"
	ENDPROC


ENDDEFINE
*
*-- EndDefine: cprogressbar
**************************************************
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform