This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathidle.lcdoc
More file actions
64 lines (46 loc) · 1.92 KB
/
idle.lcdoc
File metadata and controls
64 lines (46 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Name: idle
Type: message
Syntax: idle
Summary:
Sent periodically to the <current card> if no other <message> is being
sent.
Associations: card
Introduced: 1.0
OS: mac, windows, linux, ios, android
Platforms: desktop, server, mobile
Description:
Handle the <idle> <message> to check constantly on the status of an
<object(glossary)>, the content of a <variable>, and so forth, or to do
periodic tasks.
The period between <idle> <message|messages> is specified by the
<idleRate> and <idleTicks> <properties>.
>*Note:* Usually, it is easier and more efficient to use the send in
> time form of the send <command> than to use an <idle> <handler>,
> especially if a task needs to be <execute|executed> at regular
> intervals. This example shows an <idle> <handler> that updates a clock
> timer:
on idle -- avoid if possible
global startTime
if the seconds > startTime + 60 then -- 60 seconds have gone by
put the time into field "Clock Face"
put the seconds into startTime
end if
pass idle
end idle
The following example does the same thing more efficiently, since it
only needs to handle a single message every sixty seconds:
on updateClock -- a better way
put the time into field "Clock Face"
send "updateClock" to me in 60 seconds
end updateClock
Executing an <idle> <handler> slows down other LiveCode actions, so
<handle> the <idle> <message> only in the rare cases where the <send>
<command> cannot be used instead.
>*Note:* If there is no <idle> <handler> anywhere in the <message path>,
> no <idle> <message> is sent.
References: revVideoGrabIdle (command), send (command), wait (command),
object (glossary), current card (glossary), variable (glossary),
handler (glossary), handle (glossary), execute (glossary),
message (glossary), message path (glossary), command (glossary),
idleRate (property), idleTicks (property), properties (property)
Tags: ui