home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / tcl / tk3.3b1 / doc / DoWhenIdle.3 < prev    next >
Encoding:
Text File  |  1993-04-01  |  3.8 KB  |  99 lines

  1. '\"
  2. '\" Copyright (c) 1990 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/wish/man/RCS/DoWhenIdle.3,v 1.8 93/04/01 09:41:19 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS Tk_DoWhenIdle tkc
  25. .BS
  26. .SH NAME
  27. Tk_DoWhenIdle, Tk_CancelIdleCall \- invoke a procedure when there are no pending events
  28. .SH SYNOPSIS
  29. .nf
  30. \fB#include <tk.h>\fR
  31. .sp
  32. \fBTk_DoWhenIdle\fR(\fIproc, clientData\fR)
  33. .sp
  34. .VS
  35. \fBTk_CancelIdleCall\fR(\fIproc, clientData\fR)
  36. .VE
  37. .SH ARGUMENTS
  38. .AS Tk_IdleProc clientData
  39. .AP Tk_IdleProc *proc in
  40. Procedure to invoke.
  41. .AP ClientData clientData in
  42. Arbitrary one-word value to pass to \fIproc\fR.
  43. .BE
  44.  
  45. .SH DESCRIPTION
  46. .PP
  47. \fBTk_DoWhenIdle\fR arranges for \fIproc\fR to be invoked
  48. when the application becomes idle.  The application is
  49. considered to be idle when \fBTk_DoOneEvent\fR has been
  50. called, it couldn't find any events to handle, and it is about
  51. to go to sleep waiting for an event to occur.  At this
  52. point all pending \fBTk_DoWhenIdle\fR handlers are
  53. invoked.  For each call to \fBTk_DoWhenIdle\fR there will
  54. be a single call to \fIproc\fR;  after \fIproc\fR is
  55. invoked the handler is automatically removed.
  56. \fBTk_DoWhenIdle\fR is only useable in programs that
  57. use \fBTk_DoOneEvent\fR to dispatch events.
  58. .PP
  59. \fIProc\fP should have arguments and result that match the
  60. type \fBTk_IdleProc\fR:
  61. .nf
  62. .RS
  63. typedef void Tk_IdleProc(ClientData \fIclientData\fR);
  64. .RE
  65. .fi
  66. The \fIclientData\fP parameter to \fIproc\fR is a copy of the \fIclientData\fP
  67. argument given to \fBTk_DoWhenIdle\fR.  Typically, \fIclientData\fR
  68. points to a data structure containing application-specific information about
  69. what \fIproc\fR should do.
  70. .PP
  71. \fBTk_CancelIdleCall\fR
  72. .VS
  73. may be used to cancel one or more previous
  74. calls to \fBTk_DoWhenIdle\fR:  if there is a \fBTk_DoWhenIdle\fR
  75. handler registered for \fIproc\fR and \fIclientData\fR, then it
  76. is removed without invoking it.  If there is more than one
  77. handler on the idle list that refers to \fIproc\fR and \fIclientData\fR,
  78. all of the handlers are removed.  If no existing handlers match
  79. \fIproc\fR and \fIclientData\fR then nothing happens.
  80. .VE
  81. .PP
  82. \fBTk_DoWhenIdle\fR is most useful in situations where
  83. (a) a piece of work will have to be done but (b) it's
  84. possible that something will happen in the near future
  85. that will change what has to be done, or require something
  86. different to be done.  \fBTk_DoWhenIdle\fR allows the
  87. actual work to be deferred until all pending events have
  88. been processed.  At this point the exact work to be done
  89. will presumably be known and it can be done exactly once.
  90. .PP
  91. For example, \fBTk_DoWhenIdle\fR might be used by an editor
  92. to defer display updates until all pending commands have
  93. been processed.  Without this feature, redundant redisplays
  94. might occur in some situations, such as the processing of
  95. a command file.
  96.  
  97. .SH KEYWORDS
  98. callback, defer, handler, idle
  99.