Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug on timer, but not deterministic
Message
 
 
To
24/10/2003 04:39:12
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00840948
Message ID:
00842093
Views:
27
Fabio,

>But i not aspect this ( i put a wish for this ).

And I cast a vote against it, I don't want VFP wasting time checking for Windows Message events any more than it already does. This will only slow it down for everyone in order to make a couple of people happier. It currently checks between every line of code you write in VFP.

>I aspect that if i disable ( and reset ) the timer, it not trigger event after, but it trigger ( randomly )!

There is no real reason to call Reset as you were in your code sample. You do realize that with any interval the timer may fire right before the line of code where you are setting Enabled = .f., this message gets queued, the Enabled value gets set to .f., the message queue gets processed, which means the Timer() event gets called after it's been disabled.

If you are are worried about this sort of issue then you can write all your timer.Timer events like this:
tmrX.Timer()
if ( this.Enabled )
   ... do something useful
endif

return
You could in fact code this into your lowest level timer subclass:
define FabioTimer as Timer
Timer()
if ( this.Enabled )
   ... do something useful
endif

return this.Enabled
and then use it in all your timers:
tmrX.Timer()
local llRetVal

llRetVal = dodefault()
if ( llRetVal )
   ... do something more useful
endif

return llRetVal
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