|
|
发表于 2016-3-15 19:28:17
|
显示全部楼层
就不懂我看看呐NAME
* ^1 U8 G$ L8 A0 M* K: `8 y6 bafter - Execute a command after a time delay
" b7 n f+ a% Y! o- \; ]SYNOPSIS
# e" f7 F2 w9 K; x5 D% Q; c3 rafter ms9 F* C( _' q6 ?$ Z X
after ms ?script script script ...?6 M9 x! M' c9 J9 m( \4 r2 n3 X
after cancel id
6 o7 i. Y7 k8 o% Q4 x5 u g' Pafter cancel script script script ...# E* D; R, H* d
after idle ?script script script ...?- Q; G+ ^, r, t1 I3 f8 B2 x
after info ?id?: K/ t: V8 b$ f Y9 c
DESCRIPTION8 o" s3 h" ]* Y( z6 {3 ?" V; ~
after ms2 w' j* Y: x$ Z: T
after ms ?script script script ...?$ y1 j7 A3 \* E0 L8 G5 R$ c( t4 _
after cancel id2 C/ [! k1 W6 }- R% C
after cancel script script ...
; {, j. n- H$ {' X2 j5 gafter idle script ?script script ...?
6 `0 Z( E; [" Q9 @ aafter info ?id?
/ k7 R1 @3 f; B% bSEE ALSO8 J3 z0 Y. @. |+ D
KEYWORDS; a8 u: h$ N& u! C0 \
NAME g, D3 i4 ?1 v8 y) {: X
: v4 G. P- N) c) |7 }after - Execute a command after a time delay2 b4 w4 J( E1 H" i) y9 D/ ?
SYNOPSIS
5 k+ V" ]+ j, \: e# o3 D6 O1 B, e8 J' s; N* z- s+ h
after ms
- P- p9 d2 d, r7 w7 n# J; ]* n nafter ms ?script script script ...?- ~9 c' _8 l1 A7 Z1 F* N
after cancel id5 n. F) g$ t' v( m
after cancel script script script ...1 T7 y. Z6 h% V+ [
after idle ?script script script ...?
* I& B2 V- C6 Q& Fafter info ?id?
# Z4 r: Y: D$ i# A! O# eDESCRIPTION
/ d/ I# \' S7 n' j& O# ~1 m! D( V0 u W. x6 i
This command is used to delay execution of the program or to execute a command in background sometime in the future. It has several forms, depending on the first argument to the command:1 d6 _2 u4 j, K
after ms
& B. L0 Q" U3 I- d+ OMs must be an integer giving a time in milliseconds. The command sleeps for ms milliseconds and then returns. While the command is sleeping the application does not respond to events.0 e- ]1 W3 Q+ z$ x, H
after ms ?script script script ...?
% v# s3 X3 W4 i3 ]2 bIn this form the command returns immediately, but it arranges for a Tcl command to be executed ms milliseconds later as an event handler. The command will be executed exactly once, at the given time. The delayed command is formed by concatenating all the script arguments in the same fashion as the concat command. The command will be executed at global level (outside the context of any Tcl procedure). If an error occurs while executing the delayed command then the bgerror mechanism is used to report the error. The after command returns an identifier that can be used to cancel the delayed command using after cancel.
9 H9 H4 F, s, X; ~' xafter cancel id
6 |# s1 J M* Z/ k/ nCancels the execution of a delayed command that was previously scheduled. Id indicates which command should be canceled; it must have been the return value from a previous after command. If the command given by id has already been executed then the after cancel command has no effect.
3 |; W. j( R$ P- pafter cancel script script ...8 X* _/ i% ]. }$ F' [! ^1 j, S8 I
This command also cancels the execution of a delayed command. The script arguments are concatenated together with space separators (just as in the concat command). If there is a pending command that matches the string, it is cancelled and will never be executed; if no such command is currently pending then the after cancel command has no effect.
! |# o9 f* K& q0 z. Z* e' r+ Qafter idle script ?script script ...?
2 d; K2 r% L1 |0 v9 u7 LConcatenates the script arguments together with space separators (just as in the concat command), and arranges for the resulting script to be evaluated later as an idle callback. The script will be run exactly once, the next time the event loop is entered and there are no events to process. The command returns an identifier that can be used to cancel the delayed command using after cancel. If an error occurs while executing the script then the bgerror mechanism is used to report the error.
" u) K B' _+ V* ~) Bafter info ?id?
: V8 w$ I3 c# H; U" t* M; nThis command returns information about existing event handlers. If no id argument is supplied, the command returns a list of the identifiers for all existing event handlers created by the after command for this interpreter. If id is supplied, it specifies an existing handler; id must have been the return value from some previous call to after and it must not have triggered yet or been cancelled. In this case the command returns a list with two elements. The first element of the list is the script associated with id, and the second element is either idle or timer to indicate what kind of event handler it is.% y% _; @+ \" l! ]3 U, X" j8 l' [
The after ms and after idle forms of the command assume that the application is event driven: the delayed commands will not be executed unless the application enters the event loop. In applications that are not normally event-driven, such as tclsh, the event loop can be entered with the vwait and update commands. v# |6 O2 l/ N2 }3 b5 l# T) c: O
a2 x+ {* u8 n/ f" VSEE ALSO
C& c- ?9 B9 w J) c0 m7 P4 h! e% {' r# f5 U- A
bgerror
$ k7 }5 x0 o7 M/ S4 w( m0 t5 nKEYWORDS6 N2 W+ \% _: Z+ |; d7 k' W6 @, q
' f/ q1 ], b8 c2 acancel, delay, idle callback, sleep, time* c+ t; i- y/ ~8 U' Z# k" w, U
Copyright © 1990-1994 The Regents of the University of California.
6 F# p: A0 Q7 t0 T _' [Copyright © 1994-1996 Sun Microsystems, Inc.2 j1 I* [$ z4 ?3 L' a) k( Y( h8 c: f
Copyright © 1995-1997 Roger E. Critchlow Jr. |
|