|
发表于 2016-3-15 19:28:17
|
显示全部楼层
就不懂我看看呐NAME- G: x1 Q2 V, D; B5 x: Z
after - Execute a command after a time delay& D1 {4 K2 x3 ?
SYNOPSIS
- [# [5 h9 q0 r8 rafter ms
) a. i6 Q" K- ?* bafter ms ?script script script ...?$ v4 t! _& Y0 k8 S, ]
after cancel id! a/ t$ S# g# t) i& N! n
after cancel script script script ..." E( \8 X$ z, f7 d- O: M
after idle ?script script script ...?
7 R. i% h- m5 A3 |+ Oafter info ?id?
0 N) ^4 a6 Q7 X% G1 TDESCRIPTION. _& L. d, j& u M" V3 I# ]- h% u
after ms5 j/ o8 ~. u3 v) @
after ms ?script script script ...?
7 Y2 g& S/ S+ e# {/ p. W/ uafter cancel id w* O1 t* c- N
after cancel script script ...
" E; q6 q9 m- ^0 R8 Safter idle script ?script script ...?. o* @ _. ], R& C
after info ?id?( e0 F; e9 Y+ M
SEE ALSO/ ~, B7 T8 t% g4 z" W5 J
KEYWORDS
* M) c' D0 w: I! |0 FNAME
! e3 \! z& A. j! H; x7 Y. G7 m0 @0 x/ B' i
after - Execute a command after a time delay. K$ f/ L g3 d- S5 t* A
SYNOPSIS, s9 P I* s' L. f% T+ p1 @
9 s }; |8 k$ r# N! g4 h- H% r
after ms
, p0 t2 R% i/ k& |0 Z9 c. |after ms ?script script script ...?$ O4 a& E( u1 d7 F; X S+ I3 t; u/ Z
after cancel id T4 E. y) Q9 m, j
after cancel script script script ...
j4 Q5 M' i/ p: n, _) iafter idle ?script script script ...?
b4 G! S: Q7 \" E0 ^after info ?id?
2 s0 R& e& b i: J5 }: t* V3 TDESCRIPTION2 u6 u3 e+ @8 j9 s
0 U; e" u' N% 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:/ L2 d. ^2 I* M I5 p- k( s
after ms4 u6 p5 i" J1 q
Ms 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 w' X8 |% B0 }( z# q6 P
after ms ?script script script ...?
/ o1 T8 n+ u7 b: J( }0 \. iIn 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.
6 Z0 [/ [/ x( d9 `; c2 y \: m9 |# kafter cancel id
3 _$ l6 @( E0 Q. P: W/ w- j: eCancels 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.
: {, s( P6 X/ {after cancel script script ...
! t! e! R( B6 z! s, BThis 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.
@ f# [2 g: g% i4 m( `( eafter idle script ?script script ...?; t$ x3 Z" R+ A* |* u( H4 ~: ?- A
Concatenates 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.4 k# z5 @+ X! n) H# P) I) W3 r
after info ?id?! H* d% q3 a1 A- d7 |
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.
$ h$ M0 W8 h7 yThe 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.) m+ J7 g+ p& {
& R; U" Y l3 S& C9 _( U; OSEE ALSO
1 d. ^: \9 L4 ]& Y* m. \1 x1 r
; H6 P$ ]3 i2 p: K. ~9 e) R3 Y Tbgerror0 }- R3 S: Z: ^
KEYWORDS: K& b' r. o1 a
9 ]1 i$ D; R5 o! y: icancel, delay, idle callback, sleep, time' v8 O, [; @8 r, p6 D- O! x
Copyright © 1990-1994 The Regents of the University of California.% M; Z( l. e1 _/ f) R
Copyright © 1994-1996 Sun Microsystems, Inc.5 ]+ x- k+ V' G% Z* @& f6 [- G+ s
Copyright © 1995-1997 Roger E. Critchlow Jr. |
|