Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Timers
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00896776
Message ID:
00897054
Views:
12
Arto,

>Have anyone experience with multiple timers.

In general, bad ones. *g*

>F.ex. form has multiple ~120 checkboxes. When to (programmatically) check the checkbox is defined in DBF. It is also defined when it should be unchecked. If there are timer added to each checkbox (~120 timers) which uncheck the checkbox after the interval (interval per timer is defined the companion checkbox is checked) is gone. Would this work?

Assuming that a datetime value is accurate enough for your events. What I'd do for this is create a cursor of events something like

create cursor eventqueue ( tWhen t, lState l, cName c(20) )
index on tWhen tag tWhen

then as you read the dbf you insert records into the cursor setting some future time tWhen = datetime() + interval, to check (lState = .t.) or uncheck (lState = .f.) and log the checkbox name in the cName field. The tWhen could also be some absolute value if your dbf says to turn on the checkbox at 20:00:00, you'd just do datetime( year(), month(), day(), 20, 0, 0 ).

Then a single timer can fire off once a second looking for any records where tWhen is less than the current datetime(), if there are any records you can process them using cName and lState

loCheckbox = "thisform." + eventqueue.cName
loCheckbox.Value = eventqueue.lState

and delete the record from the eventqueue.
df (was a 10 time MVP)

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

Click here to load this message in the networking platform