Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding up DoEvents()
Message
 
 
To
30/09/1998 20:04:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00142550
Message ID:
00142833
Views:
27
David,
* FastDoEvents.prg 30-Sep-98

* this workaround speeds up a DoEvent call

local lnRow, lnCol, lcWindow

lcWindow = wontop()
lnRow = mrow( lcWindow )
lnCol = mcol( lcWindow )
if ( lnRow > 0 ) and ( lnCol > 0 )
   * mouse still within VFP window, so it's ok to mouse
   mouse at mrow(), mcol() window (lcWindow)
endif

DoEvents()
This is what I worked up after posting the FAQ yesterday and having a TopLevel form app pulling the mouse back inside VFP from other windows. I've got a complex form (100 containers each with 5 objects inside) that gets refreshed every ten seconds it takes on the order of 1.5 seconds to refresh the form. A couple of the objects do a DoEvents() in their Refrsh() in order to catch mouse events that may occur during the Form.Refresh().

I've got test code in the form that times 2 refreshs. Using the above FastDoEvents() shaves a second off the test time and also makes it take a more predictable time. Without the MOUSE command it takes an average of 3.956 with a range of 3.571 to 4.140 seconds. With the MOUSE command it takes an average of 2.953 with a range of 2.872 to 3.082 seconds.

So if you come up with any improvements/fixes to the above code I'd appreciate hearing about them.

>That's really interesting Frank. So we can create a library Function called DoEventsFast() which does what you do above and replace any calls in our code.
>Do you foresee any downside? Eg I have a busy web server app, like the UT app actually, that does a Doevents() every 2 seconds - this is on a powerful NT Server - so it'll be interesting what effect it has.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform