| 1 |
# Copyright (c) 1994 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994 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 |
# @(#) EventInit.3 1.4 95/05/06 15:29:22 |
| 7 |
# |
| 8 |
|
| 9 |
=head1 NAME |
| 10 |
|
| 11 |
Tk_EventInit - Use the Tk event loop without the rest of Tk |
| 12 |
|
| 13 |
=for category C Programming |
| 14 |
|
| 15 |
=head1 SYNOPSIS |
| 16 |
|
| 17 |
B<#include E<lt>tk.hE<gt>> |
| 18 |
|
| 19 |
int |
| 20 |
B<Tk_EventInit>(I<interp>) |
| 21 |
|
| 22 |
=head1 ARGUMENTS |
| 23 |
|
| 24 |
=over 4 |
| 25 |
|
| 26 |
=item Tcl_Interp *interp (in) |
| 27 |
|
| 28 |
Interpreter in which event-related Tk commands are to be created. |
| 29 |
|
| 30 |
=back |
| 31 |
|
| 32 |
=head1 DESCRIPTION |
| 33 |
|
| 34 |
This procedure may be invoked to use the Tk event management functions |
| 35 |
without the rest of Tk (e.g., in applications that do not have access |
| 36 |
to a display). |
| 37 |
B<Tk_EventInit> creates the B<after> and B<fileevent> commands |
| 38 |
in I<interp>. |
| 39 |
It also creates versions of the B<tkwait> and B<update> commands |
| 40 |
with reduced functionality: the B<tkwait> command supports only |
| 41 |
the B<variable> option, not B<visibility> or $widget, |
| 42 |
and B<update> does not check for X events. |
| 43 |
B<Tk_EventInit> always returns B<TCL_OK> to signal that it |
| 44 |
completed successfully. |
| 45 |
|
| 46 |
The event-management procedures in Tk are divided into two |
| 47 |
groups, those that can be used stand-alone and those that |
| 48 |
require the full Tk library to be present. |
| 49 |
The following procedures may be used stand-alone: |
| 50 |
B<Tk_CreateFileHandler>, B<Tk_CreateFileHandler2>, |
| 51 |
B<Tk_DeleteFileHandler>, B<Tk_CreateTimerHandler>, |
| 52 |
B<Tk_DeleteTimerHandler>, B<Tk_DoWhenIdle>, B<Tk_CancelIdleCall>, |
| 53 |
B<Tk_DoOneEvent>, B<Tk_Sleep>, and B<Tk_BackgroundError>. |
| 54 |
Note that B<Tk_MainLoop> cannot be used without the full Tk library, |
| 55 |
since it checks to see if windows are still open. |
| 56 |
If an application uses the event procedures stand-alone, it must |
| 57 |
include its own main loop that invokes B<Tk_DoOneEvent> repeatedly. |
| 58 |
|
| 59 |
B<Tk_EventInit> is typically called from an application's |
| 60 |
B<Tcl_AppInit> procedure; it should not be invoked in applications |
| 61 |
that use the full Tk library (e.g., those that have already invoked |
| 62 |
B<Tk_CreateMainWindow>). |
| 63 |
However, it is OK for an application to start up using B<Tk_EventInit>, |
| 64 |
compute without X for a while, and later invoke B<Tk_CreateMainWindow>. |
| 65 |
When B<Tk_CreateMainWindow> is invoked, the full suite of windowing |
| 66 |
Tcl commands will become available, and the full-blown versions of |
| 67 |
B<tkwait> and B<update> will replace the abridged versions |
| 68 |
created with B<Tk_EventInit>. |
| 69 |
|
| 70 |
=head1 KEYWORDS |
| 71 |
|
| 72 |
event management, Tcl_AppInit |