Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / after.pod
CommitLineData
86530b38
AT
1# Copyright (c) 1990-1994 The Regents of the University of California.
2# Copyright (c) 1994-1996 Sun Microsystems, Inc.
3# See the file "license.terms" for information on usage and redistribution
4# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5#
6#
7
8=head1 NAME
9
10Tk::after - Execute a command after a time delay
11
12=for category Binding Events and Callbacks
13
14=head1 SYNOPSIS
15
16S< >I<$widget>-E<gt>B<after>(I<ms>)
17
18S< >I<$id> = I<$widget>-E<gt>B<after>(I<ms>?,I<callback>?)
19
20S< >I<$id> = I<$widget>-E<gt>B<repeat>(I<ms>?,I<callback>?)
21
22S< >I<$widget>-E<gt>B<afterCancel>(I<$id>)
23
24S< >I<$id> = I<$widget>-E<gt>B<afterIdle>(I<callback>)
25
26S< >I<$widget>-E<gt>B<afterInfo>?(I<$id>)?
27
28=head1 DESCRIPTION
29
30This method is used to delay execution of the program or to execute
31a callback in background sometime in the future.
32
33In perl/Tk I<$widget>-E<gt>B<after> is implemented via the class C<Tk::After>,
34and callbacks are associated with I<$widget>, and are automatically cancelled
35when the widget is destroyed. An almost identical interface, but without
36automatic cancel, and without repeat is provided via Tk::after method.
37
38The internal Tk::After class has the following synopsis:
39
40 $id = Tk::After->new($widget,$time,'once',callback);
41 $id = Tk::After->new($widget,$time,'repeat',callback);
42 $id->cancel;
43
44The B<after> method has several forms as follows:
45
46=over 4
47
48=item I<$widget>-E<gt>B<after>(I<ms>)
49
50The value I<ms> must be an integer giving a time in milliseconds.
51The command sleeps for I<ms> milliseconds and then returns.
52While the command is sleeping the application does not respond to
53events.
54
55=item I<$widget>-E<gt>B<after>(I<ms>,I<callback>)
56
57In this form the command returns immediately, but it arranges
58for I<callback> be executed I<ms> milliseconds later as an
59event handler.
60The callback will be executed exactly once, at the given time.
61The command will be executed in context of I<$widget>.
62If an error occurs while executing the delayed command then the
63L<Tk::Error|Tk::Error> mechanism is used to report the error.
64The B<after> command returns an identifier (an object in the perl/Tk
65case) that can be used to cancel the delayed command using B<afterCancel>.
66
67=item I<$widget>-E<gt>B<repeat>(I<ms>,I<callback>)
68
69In this form the command returns immediately, but it arranges
70for I<callback> be executed I<ms> milliseconds later as an
71event handler. After I<callback> has executed it is re-scheduled,
72to be executed in a futher I<ms>, and so on until it is cancelled.
73
74=item I<$widget>-E<gt>B<afterCancel>(I<$id>)
75
76=item I<$id>-E<gt>cancel
77
78Cancels the execution of a delayed command that
79was previously scheduled.
80I<$id> indicates which command should be canceled; it must have
81been the return value from a previous B<after> command.
82If the command given by I<$id> has already been executed (and
83is not scheduled to be executed again) then B<afterCancel>
84has no effect.
85
86=item I<$widget>-E<gt>B<afterCancel>(I<callback>)
87
88I<This form is not robust in perl/Tk - its use is deprecated.>
89This command should also cancel the execution of a delayed command.
90The I<callback> argument is compared with pending callbacks,
91if a match is found, that callback is
92cancelled and will never be executed; if no such callback is
93currently pending then the B<afterCancel> has no effect.
94
95=item I<$widget>-E<gt>B<afterIdle>(I<callback>)
96
97Arranges for I<callback> to be evaluated later as an idle callback.
98The script will be run exactly once, the next time the event
99loop is entered and there are no events to process.
100The command returns an identifier that can be used
101to cancel the delayed command using B<afterCancel>.
102If an error occurs while executing the script then the
103L<Tk::Error|Tk::Error> mechanism is used to report the error.
104
105=item I<$widget>-E<gt>B<afterInfo>?(I<$id>)?
106
107This command returns information about existing event handlers. If no I<$id>
108argument is supplied, the command returns a list of the identifiers for all
109existing event handlers created by the B<after> command for this MainWindow. If
110I<$id> is supplied, it specifies an existing handler; I<$id> must have been the
111return value from some previous call to B<after> and it must not have triggered
112yet or been cancelled. In this case the command returns a list with two elements.
113The first element of the list is the callback associated with I<$id>, and the
114second element is either B<idle> or B<timer> to indicate what kind of event
115handler it is.
116
117=back
118
119The B<after>(I<ms>) and B<afterIdle> forms of the command
120assume that the application is event driven: the delayed commands
121will not be executed unless the application enters the event loop.
122In applications that are not normally event-driven,
123the event loop can be entered with the B<vwait> and B<update> commands.
124
125=head1 SEE ALSO
126
127L<Tk::Error|Tk::Error>
128L<Tk::callbacks|Tk::callbacks>
129
130=head1 KEYWORDS
131
132cancel, delay, idle callback, sleep, time
133
134=cut