Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form Controls go blank during processing
Message
From
25/06/2008 21:35:45
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, United States
 
 
To
24/06/2008 11:03:39
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP1
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01326002
Message ID:
01326813
Views:
14
Hi Tom,
I understand the BINDEVENTs idea, but I'm not sure it will execute VFP code when the VFP is so busy. The olecontrol must work because it's as if you have another instance of VFP running. During your long running process, if you open another VFP window, it paints just fine I'm betting. I built this form so an animated gif keeps moving when VPF is busy checking connections. The same idea should work for you. I got the idea from someone else, but I can't remember who to give them credit.
LongRunning.ImDoneWithAnotherOne("Part X")
PROCEDURE ImDoneWithAnotherOne(Item2Check)
IF ISNULL(This.oStatus)
    This.CreateStatus()
ENDIF
This.oStatus.ShowProgress(m.Item2Check)
* Find the record and check it. Nothing complicated here. It will show the updated checkmark.
ENDPROC
We create the form like this, but if you know the file is registered, you don't have to do all this.
The form with the "something to show" must be marked OLE PUBLIC and ShowWindow 2.
   TRY
      This.oStatus = CREATEOBJECT(m.Class2Use)
   CATCH TO oErr WHEN INLIST(oErr.errorno,1733,1426)
      TRY
         Command2Run = [/N "] + m.ExeName + [" /regserver]
         WAIT WINDOW "Registering " + m.Class2Use + ":   (RUN " + m.Command2Run  + ")" NOWAIT
         RUN &Command2Run.
         WAIT WINDOW 'Done Registering' NOWAIT
         This.oStatus = CREATEOBJECT(m.Class2Use)
      CATCH TO oErr 
         *WAIT WINDOW oErr.Message TIMEOUT 3
         This.oStatus = NEWOBJECT("frmStatusOLE", "frmStatusOLE.VCX")   
      ENDTRY
   CATCH TO oErr
      This.oStatus = NEWOBJECT("frmStatusOLE", "frmStatusOLE.VCX")   
   ENDTRY
>Hi Charlie, long time no see.
>
>Sergey is a genius (no doubt) so I must be doing something wrong on my end but not sure what. I have a main form that kicks off the process to download several 500K row tables that get attached directly to Excel's pivotcache object. That all works great but the entire process to load, save, zip and FTP takes in excess of 35 minutes.
>
>Based on feedback I created a seperate modeless form that only contains a grid displaying how many rows in each table and a check mark is assigned to a column when a process completes. Unfortunately, if I switch to another application (such as IE) then come back to my VFP app, the form is all gray - not even an outline of the grid can be shown.
>
>I added the following code to the modeless forms LOAD event:
>
>#DEFINE WM_ACTIVATE 0x0006
>BINDEVENT( _VFP.hWnd, WM_ACTIVATE, This, "refreshstatus" )
>
>The UNLOAD event contains code to release the BINDEVENT as follows:
>#DEFINE WM_ACTIVATE 0x0006
>UNBINDEVENTS( _VFP.hWnd,WM_ACTIVATE )
>
>Here is what is contained in my custom REFRESHSTATUS() method:
>
>WAIT WINDOW NOWAIT "Hey, the refreshstatus method was just called at " + TRANSFORM( DATETIME() )
>ThisForm.Draw()
>
>I just removed some of the tables (so it runs in 3 minutes) for testing and the REFRESHSTATUS() method never fired but I did experience a blank status form (no visible grid). However, I can assure you it is there at the beginning.
>
>I also tried to add DOEVENTS before the process to download the data but once that kicks in I guess I am just waiting for it to finish. '
>
>Bottom line - I am still trying to work out a solution...
Charlie
Previous
Reply
Map
View

Click here to load this message in the networking platform