home *** CD-ROM | disk | FTP | other *** search
- '\"
- '\" Copyright (c) 1990 The Regents of the University of California.
- '\" All rights reserved.
- '\"
- '\" Permission is hereby granted, without written agreement and without
- '\" license or royalty fees, to use, copy, modify, and distribute this
- '\" documentation for any purpose, provided that the above copyright
- '\" notice and the following two paragraphs appear in all copies.
- '\"
- '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
- '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
- '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- '\"
- '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- '\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
- '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
- '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- '\"
- '\" $Header: /user6/ouster/wish/man/RCS/TimerHndlr.3,v 1.6 93/04/01 09:41:59 ouster Exp $ SPRITE (Berkeley)
- '\"
- .so man.macros
- .HS Tk_CreateTimerHandler tkc
- .BS
- .SH NAME
- Tk_CreateTimerHandler, Tk_DeleteTimerHandler \- call a procedure at a
- given time
- .SH SYNOPSIS
- .nf
- \fB#include <tk.h>\fR
- .sp
- Tk_TimerToken
- \fBTk_CreateTimerHandler\fR(\fImilliseconds, proc, clientData\fR)
- .sp
- \fBTk_DeleteTimerHandler\fR(\fItoken\fR)
- .SH ARGUMENTS
- .AS Tk_TimerToken milliseconds
- .AP int milliseconds in
- How many milliseconds to wait before invoking \fIproc\fR.
- .AP Tk_TimerProc *proc in
- Procedure to invoke after \fImilliseconds\fR have elapsed.
- .AP ClientData clientData in
- Arbitrary one-word value to pass to \fIproc\fR.
- .AP Tk_TimerToken token in
- Token for previously-created timer handler (the return value
- from some previous call to \fBTk_CreateTimerHandler).
- .BE
-
- .SH DESCRIPTION
- .PP
- \fBTk_CreateTimerHandler\fR arranges for \fIproc\fR to be
- invoked at a time \fImilliseconds\fR milliseconds in the
- future.
- The callback to \fIproc\fR will be made by \fBTk_DoOneEvent\fR,
- so \fBTk_CreateTimerHandler\fR is only useful in
- programs that dispatch events
- through \fBTk_DoOneEvent\fR or through other Tk procedures that
- call \fBTk_DoOneEvent\fR, such as \fBTk_MainLoop\fR. The call
- to \fIproc\fR may not be made at the exact time given by
- \fImilliseconds\fR: it will be made at the next opportunity
- after that time. For example, if \fBTk_DoOneEvent\fR isn't
- called until long after the time has elapsed, or if there
- are other pending events to process before the call to
- \fIproc\fR, then the call to \fIproc\fR will be delayed.
- .PP
- \fIProc\fP should have arguments and return value that match
- the type \fBTk_TimerProc\fR:
- .nf
- .RS
- typedef void Tk_TimerProc(ClientData \fIclientData\fR);
- .RE
- .fi
- The \fIclientData\fP parameter to \fIproc\fR is a
- copy of the \fIclientData\fP argument given to
- \fBTcl_CreateTimerHandler\fR when the callback
- was created. Typically, \fIclientData\fR points to a data
- structure containing application-specific information about
- what to do in \fIproc\fR.
- .PP
- \fBTk_DeleteTimerHandler\fR may be called to delete a
- previously-created timer handler. It deletes the handler
- indicated by \fItoken\fR so that no call to \fIproc\fR
- will be made; if that handler no longer exists
- (e.g. because the time period has already elapsed and \fIproc\fR
- has been invoked) then \fBTk_DeleteTimerHandler\fR does nothing.
-
- .SH KEYWORDS
- callback, clock, handler, timer
-