|
发表于 2016-3-15 19:28:17
|
显示全部楼层
就不懂我看看呐NAME
+ O$ B7 g Z4 ^ ?% R6 `& oafter - Execute a command after a time delay
" K, {* \+ s3 ^5 q. M- zSYNOPSIS$ m5 g6 V; g6 E/ x- R
after ms
2 C' _: u& ?: Z: d7 ?after ms ?script script script ...?9 Y: o% x& f* S* D
after cancel id; |4 I( n- K& D) z* c
after cancel script script script ...
3 i6 A7 w+ ^+ I; }after idle ?script script script ...?
: c/ v5 }/ @2 y: aafter info ?id?
& \/ e0 P8 W! R2 eDESCRIPTION1 K( d) ~& f/ P& T+ m" i2 V
after ms- N0 d5 R5 q6 K( Q1 e" f. [2 V# `
after ms ?script script script ...?
$ Z, c- [1 R! }# zafter cancel id8 w# `5 h& N3 j- h$ d! P R2 _
after cancel script script ..., S# e- x1 u0 S$ [( j
after idle script ?script script ...?2 |! f8 v6 S9 ]9 F o8 F0 s
after info ?id?2 y8 v& W) J8 `: p! O* L
SEE ALSO$ p4 b2 F/ S: i% x4 U
KEYWORDS- w$ \4 F: [# ^2 c
NAME0 T. w: J" g0 ?& ^* |: f3 `
# M& [; M( D5 V8 O/ N
after - Execute a command after a time delay; c) ]- O$ C: T; d' e \+ L: \& z
SYNOPSIS: o9 {6 E$ n6 ?0 s2 K
# ]" k/ A; ^! d3 q' p* U: \
after ms
0 h! d3 G- k" `% }* q3 p6 Aafter ms ?script script script ...?
) O6 t0 R8 a4 d" hafter cancel id# u' d+ Q- H1 p; q: F' ^; O
after cancel script script script ...- s; Q. a2 v j2 M7 \$ y
after idle ?script script script ...?8 o) w# i' a1 l* y0 M5 F9 I
after info ?id?! k. u2 E0 a; `6 ~7 w H0 n# x, @
DESCRIPTION# l, E# ~! ^' [1 @5 |6 Z
8 `, Z$ f: f# EThis 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:
; n+ g! G) g5 E$ I, rafter ms
* i6 h; q; L+ p7 L# KMs 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.
9 m: M ^! N1 F o" a `9 v, Zafter ms ?script script script ...?
' O$ I# A# b- b+ pIn 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.* V. o: D4 \. e4 q8 N d) u+ R
after cancel id
( R% O- R, U8 S! e0 ]& z! 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.
; b0 i+ L: P" k+ `; x; c3 Eafter cancel script script ...: s% |1 l O7 o3 l/ `0 P' O$ Q7 r8 g
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.4 V1 U$ s i5 V" j- O6 @- l7 ^/ u
after idle script ?script script ...?
8 G) Y1 {- R9 d. H- S( OConcatenates 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.! T1 A% q! i) N3 I; q, |2 v
after info ?id?7 U& B& `' |3 z, j6 z, |& D. u5 R
This 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.
0 i2 ^* ], U# rThe 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., G" M" Y1 M r5 F$ r4 A5 s5 s
) c- e8 k, n+ V+ _: ISEE ALSO
' J: z# M4 \% c6 T8 C- R! `% i" \7 N3 }# x4 n* Y* p q* ]
bgerror
& M, u( D% t h8 B) z2 zKEYWORDS/ _, Q" P9 y5 X1 H9 G, I
! H; p% y- I3 f/ i( M9 C, m: U# d
cancel, delay, idle callback, sleep, time& a5 k4 j3 f# a3 W# Q
Copyright © 1990-1994 The Regents of the University of California.
) M$ K* J/ Z+ W$ HCopyright © 1994-1996 Sun Microsystems, Inc.
( A* L }+ @0 PCopyright © 1995-1997 Roger E. Critchlow Jr. |
|