Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wait WIndow Does Not Show the Required Message
Message
From
14/01/2014 14:44:02
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Wait WIndow Does Not Show the Required Message
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01591858
Message ID:
01591858
Views:
55
I am trying to include Parallelfox in my Code. Before parallelfox I was able to display message using Wint Window....NOWAIT. But after parallel Fox inclusion it is giving error as Error: 2031 Message: User-interface operation not allowed at this time.

If I use
Sys(2335, 1) && disable unattended mode, allow UI
WAIT WINDOW RECNO() NOWAiT
The wait window shows 0 outside the VFP Screen.

How Could I Display that which Record is being updated. Here is my code
Local Parallel as Parallel
Parallel = NewObject("Parallel", "ParallelFox.vcx")
Parallel.StartWorkers()
SCAN
iFilename=ALLTRIM(Fullpath)
oFilename=ALLTRIM(Newpath)
Parallel.SetWorkerCount(Parallel.CPUCount)
*Parallel.StartWorkers(FULLPATH('Convert.prg'),,.T.)
Parallel.do("PS2PDF",'convert.prg',,iFilename,oFilename)
ENDSCAN
Parallel.Wait(.T.)
Parallel.StopWorkers()


** Convert ps files to PDF Using ps2PDF.Dll
PROCEDURE ps2PDF
PARAMETERS iFilename,oFilename
DECLARE INTEGER _apCreate@0   IN ps2pdf.dll AS apCreate
DECLARE         _apClose@4    IN ps2pdf.dll AS apClose   INTEGER id
DECLARE INTEGER _apConvert@4  IN ps2pdf.dll AS apConvert INTEGER id
DECLARE INTEGER _apSetFunc@24 IN ps2pdf.dll AS apSetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
DECLARE INTEGER _apGetFunc@24 IN ps2pdf.dll AS apGetFunc INTEGER id, INTEGER code, INTEGER nOptVal1, INTEGER nOptVal2, STRING pOptVal1, STRING pOptVal2
#define AP_Set_Output     3000
#define AP_Set_Input      3001
id=apCreate()
IF (id # 0)
apSetFunc(id, AP_Set_Input , 0, 0,iFilename, 0)  &&input file.
apSetFunc(id, AP_Set_Output, 0, 0,oFilename, 0) &&output format and file.
apConvert(id)
apClose(id)
*Sys(2335, 1)	&& disable unattended mode, allow UI
WAIT WINDOW RECNO() NOWAiT
ENDIF
ENDPROC
Here is one of The sample Example given by ParallelFox which Shows How status bar is Updated in Run Time, but I could Not Comprehend it completely to incorporate in my code. Your Guidance will be appreciable.
* Progress example using thermometer form
Local loMyObject
Set Path To "..;examples" Additive 
loMyObject = CreateObject("MyObject")

_Screen.AddObject("oMyHandler", "MyHandler")

loMyObject.Test()


Return 

Define Class MyHandler as Custom

Procedure DisplayProgress
	Lparameters lnPercent, lcMessage

	_VFP.StatusBar = lcMessage + " (" + Transform(lnPercent) + "%)"

EndProc 

EndDefine 


DEFINE CLASS MyObject AS Custom

Procedure Test
	Local i, lnTimer, loMyObject
	Local Parallel as Parallel of ParallelFox.vcx
	Parallel = NewObject("Parallel", "ParallelFox.vcx")

	Parallel.StartWorkers(FullPath("ProgressEvent.prg"))

	Parallel.BindEvent("UpdateProgress", _Screen.oMyHandler, "DisplayProgress")
	
	lnTimer = Seconds()

	Parallel.CallMethod("SimulateReport", This.Class, This.ClassLibrary)

EndProc 

Procedure SimulateReport
	Local lnPage	
	Local Worker as Worker of ParallelFox.vcx
	Worker = NewObject("Worker", "ParallelFox.vcx") 

	For lnPage = 1 to 100
		Worker.UpdateProgress(lnPage, "Printing Report: Page " + Transform(lnPage) + " of 100")
		This.RunUnits(4)
	EndFor 
	Worker.UpdateProgress(100, "Report Complete", .t.)
EndProc 

Procedure SimulateWork
	Local i

	For i = 1 to 1000000
		* Peg CPU
	EndFor
EndProc 

Procedure RunUnits
	Lparameters lnUnits
	Local i
	For i = 1 to lnUnits
		This.SimulateWork()
	EndFor 	
EndProc 

ENDDEFINE
Regards
Harsh
Reply
Map
View

Click here to load this message in the networking platform