Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Breaking apps
Message
From
15/12/1999 10:50:48
 
 
To
15/12/1999 10:10:22
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00304036
Message ID:
00304091
Views:
25
Tom-

>I have an app that using a timer control I simulate a loop. The loop, using a windows api calls Carbon Copy 32 to initiate file transfers. I need to find a way to break the app out of the loop to it's 'paused' state. (When the timer is counting.) I would like this to be done with a command button to keep the user interface simple for the not so intelligent user. Any ideas?

Here a simple example that will show you one way to pause a loop. It uses two buttons--one to start a loop and one to stop it. You'll need to adapt it, of course, to your specific case. HTH
**************************************************
*-- Form:         form1 (c:\nec\library\classes\temp.scx)
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   12/15/99 08:59:04 AM
*
DEFINE CLASS form1 AS form


	Top = 62
	Left = 95
	Height = 115
	Width = 218
	DoCreate = .T.
	Caption = "Form1"
	continue = .T.
	counter = 0
	Name = "Form1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 72, ;
		Left = 12, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Start Loop", ;
		Name = "Command1"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 72, ;
		Left = 108, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Stop Loop", ;
		Name = "Command2"


	ADD OBJECT text1 AS textbox WITH ;
		ControlSource = "thisform.counter", ;
		Height = 23, ;
		Left = 12, ;
		ReadOnly = .T., ;
		Top = 12, ;
		Width = 100, ;
		Name = "Text1"


	ADD OBJECT text2 AS textbox WITH ;
		ControlSource = "thisform.counter", ;
		Height = 23, ;
		Left = 12, ;
		ReadOnly = .T., ;
		Top = 36, ;
		Width = 100, ;
		Name = "Text2"


	PROCEDURE command1.Click
		LOCAL lni
		lni = 0
		WITH thisform
			.continue = .T.
			.text2.value = "Looping..."
			DO WHILE .continue .AND. lni < 1000000
				IF MOD( lni, 1000 ) = 0
					DOEVENTS
				ENDIF
				.counter = .counter + 1
				lni = lni + 1
				.text1.refresh
			ENDDO 
			.text2.value = "Done."
		ENDWITH
	ENDPROC


	PROCEDURE command2.Click
		thisform.continue = .F.
	ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************
Previous
Reply
Map
View

Click here to load this message in the networking platform