Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
26 | .\" Set up some character translations and predefined strings. \*(-- will | |
27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left | |
28 | .\" double quote, and \*(R" will give a right double quote. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie n \{\ | |
35 | . ds -- \(*W- | |
36 | . ds PI pi | |
37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch | |
38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch | |
39 | . ds L" "" | |
40 | . ds R" "" | |
41 | . ds C` "" | |
42 | . ds C' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "AFTER 1" | |
132 | .TH AFTER 1 "2000-12-30" "perl v5.8.0" "User Contributed Perl Documentation" | |
133 | .SH "NAME" | |
134 | Tk::after \- Execute a command after a time delay | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | \&\ \fI$widget\fR\->\fBafter\fR(\fIms\fR) | |
138 | .PP | |
139 | \&\ \fI$id\fR = \fI$widget\fR\->\fBafter\fR(\fIms\fR?,\fIcallback\fR?) | |
140 | .PP | |
141 | \&\ \fI$id\fR = \fI$widget\fR\->\fBrepeat\fR(\fIms\fR?,\fIcallback\fR?) | |
142 | .PP | |
143 | \&\ \fI$widget\fR\->\fBafterCancel\fR(\fI$id\fR) | |
144 | .PP | |
145 | \&\ \fI$id\fR = \fI$widget\fR\->\fBafterIdle\fR(\fIcallback\fR) | |
146 | .PP | |
147 | \&\ \fI$widget\fR\->\fBafterInfo\fR?(\fI$id\fR)? | |
148 | .SH "DESCRIPTION" | |
149 | .IX Header "DESCRIPTION" | |
150 | This method is used to delay execution of the program or to execute | |
151 | a callback in background sometime in the future. | |
152 | .PP | |
153 | In perl/Tk \fI$widget\fR\->\fBafter\fR is implemented via the class \f(CW\*(C`Tk::After\*(C'\fR, | |
154 | and callbacks are associated with \fI$widget\fR, and are automatically cancelled | |
155 | when the widget is destroyed. An almost identical interface, but without | |
156 | automatic cancel, and without repeat is provided via Tk::after method. | |
157 | .PP | |
158 | The internal Tk::After class has the following synopsis: | |
159 | .PP | |
160 | .Vb 3 | |
161 | \& $id = Tk::After->new($widget,$time,'once',callback); | |
162 | \& $id = Tk::After->new($widget,$time,'repeat',callback); | |
163 | \& $id->cancel; | |
164 | .Ve | |
165 | .PP | |
166 | The \fBafter\fR method has several forms as follows: | |
167 | .IP "\fI$widget\fR\->\fBafter\fR(\fIms\fR)" 4 | |
168 | .IX Item "$widget->after(ms)" | |
169 | The value \fIms\fR must be an integer giving a time in milliseconds. | |
170 | The command sleeps for \fIms\fR milliseconds and then returns. | |
171 | While the command is sleeping the application does not respond to | |
172 | events. | |
173 | .IP "\fI$widget\fR\->\fBafter\fR(\fIms\fR,\fIcallback\fR)" 4 | |
174 | .IX Item "$widget->after(ms,callback)" | |
175 | In this form the command returns immediately, but it arranges | |
176 | for \fIcallback\fR be executed \fIms\fR milliseconds later as an | |
177 | event handler. | |
178 | The callback will be executed exactly once, at the given time. | |
179 | The command will be executed in context of \fI$widget\fR. | |
180 | If an error occurs while executing the delayed command then the | |
181 | Tk::Error mechanism is used to report the error. | |
182 | The \fBafter\fR command returns an identifier (an object in the perl/Tk | |
183 | case) that can be used to cancel the delayed command using \fBafterCancel\fR. | |
184 | .IP "\fI$widget\fR\->\fBrepeat\fR(\fIms\fR,\fIcallback\fR)" 4 | |
185 | .IX Item "$widget->repeat(ms,callback)" | |
186 | In this form the command returns immediately, but it arranges | |
187 | for \fIcallback\fR be executed \fIms\fR milliseconds later as an | |
188 | event handler. After \fIcallback\fR has executed it is re\-scheduled, | |
189 | to be executed in a futher \fIms\fR, and so on until it is cancelled. | |
190 | .IP "\fI$widget\fR\->\fBafterCancel\fR(\fI$id\fR)" 4 | |
191 | .IX Item "$widget->afterCancel($id)" | |
192 | .PD 0 | |
193 | .IP "\fI$id\fR\->cancel" 4 | |
194 | .IX Item "$id->cancel" | |
195 | .PD | |
196 | Cancels the execution of a delayed command that | |
197 | was previously scheduled. | |
198 | \&\fI$id\fR indicates which command should be canceled; it must have | |
199 | been the return value from a previous \fBafter\fR command. | |
200 | If the command given by \fI$id\fR has already been executed (and | |
201 | is not scheduled to be executed again) then \fBafterCancel\fR | |
202 | has no effect. | |
203 | .IP "\fI$widget\fR\->\fBafterCancel\fR(\fIcallback\fR)" 4 | |
204 | .IX Item "$widget->afterCancel(callback)" | |
205 | \&\fIThis form is not robust in perl/Tk \- its use is deprecated.\fR | |
206 | This command should also cancel the execution of a delayed command. | |
207 | The \fIcallback\fR argument is compared with pending callbacks, | |
208 | if a match is found, that callback is | |
209 | cancelled and will never be executed; if no such callback is | |
210 | currently pending then the \fBafterCancel\fR has no effect. | |
211 | .IP "\fI$widget\fR\->\fBafterIdle\fR(\fIcallback\fR)" 4 | |
212 | .IX Item "$widget->afterIdle(callback)" | |
213 | Arranges for \fIcallback\fR to be evaluated later as an idle callback. | |
214 | The script will be run exactly once, the next time the event | |
215 | loop is entered and there are no events to process. | |
216 | The command returns an identifier that can be used | |
217 | to cancel the delayed command using \fBafterCancel\fR. | |
218 | If an error occurs while executing the script then the | |
219 | Tk::Error mechanism is used to report the error. | |
220 | .IP "\fI$widget\fR\->\fBafterInfo\fR?(\fI$id\fR)?" 4 | |
221 | .IX Item "$widget->afterInfo?($id)?" | |
222 | This command returns information about existing event handlers. If no \fI$id\fR | |
223 | argument is supplied, the command returns a list of the identifiers for all | |
224 | existing event handlers created by the \fBafter\fR command for this MainWindow. If | |
225 | \&\fI$id\fR is supplied, it specifies an existing handler; \fI$id\fR must have been the | |
226 | return value from some previous call to \fBafter\fR and it must not have triggered | |
227 | yet or been cancelled. In this case the command returns a list with two elements. | |
228 | The first element of the list is the callback associated with \fI$id\fR, and the | |
229 | second element is either \fBidle\fR or \fBtimer\fR to indicate what kind of event | |
230 | handler it is. | |
231 | .PP | |
232 | The \fBafter\fR(\fIms\fR) and \fBafterIdle\fR forms of the command | |
233 | assume that the application is event driven: the delayed commands | |
234 | will not be executed unless the application enters the event loop. | |
235 | In applications that are not normally event\-driven, | |
236 | the event loop can be entered with the \fBvwait\fR and \fBupdate\fR commands. | |
237 | .SH "SEE ALSO" | |
238 | .IX Header "SEE ALSO" | |
239 | Tk::Error | |
240 | Tk::callbacks | |
241 | .SH "KEYWORDS" | |
242 | .IX Header "KEYWORDS" | |
243 | cancel, delay, idle callback, sleep, time |