diff options
author | rjohnson <rjohnson> | 1998-04-01 09:37:39 (GMT) |
---|---|---|
committer | rjohnson <rjohnson> | 1998-04-01 09:37:39 (GMT) |
commit | 13242623d2ff3ea02ab6a62bfb48a7dbb5c27e22 (patch) | |
tree | 3100714738a7941b590efee466a774862f9671c3 /doc/Tk_Main.3 | |
parent | e4ab1102029f9ac557ff190bfb9d34408340f345 (diff) | |
download | tk-13242623d2ff3ea02ab6a62bfb48a7dbb5c27e22.zip tk-13242623d2ff3ea02ab6a62bfb48a7dbb5c27e22.tar.gz tk-13242623d2ff3ea02ab6a62bfb48a7dbb5c27e22.tar.bz2 |
Initial revision
Diffstat (limited to 'doc/Tk_Main.3')
-rw-r--r-- | doc/Tk_Main.3 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/doc/Tk_Main.3 b/doc/Tk_Main.3 new file mode 100644 index 0000000..7565aae --- /dev/null +++ b/doc/Tk_Main.3 @@ -0,0 +1,61 @@ +'\" +'\" Copyright (c) 1994 The Regents of the University of California. +'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +'\" SCCS: @(#) Tk_Main.3 1.7 96/03/26 18:19:21 +'\" +.so man.macros +.TH Tk_Main 3 4.0 Tk "Tk Library Procedures" +.BS +.SH NAME +Tk_Main \- main program for Tk-based applications +.SH SYNOPSIS +.nf +\fB#include <tk.h>\fR +.sp +\fBTk_Main\fR(\fIargc, argv, appInitProc\fR) +.SH ARGUMENTS +.AS Tcl_AppInitProc *appInitProc +.AP int argc in +Number of elements in \fIargv\fR. +.AP char *argv[] in +Array of strings containing command-line arguments. +.AP Tcl_AppInitProc *appInitProc in +Address of an application-specific initialization procedure. +The value for this argument is usually \fBTcl_AppInit\fR. +.BE + +.SH DESCRIPTION +.PP +\fBTk_Main\fR acts as the main program for most Tk-based applications. +Starting with Tk 4.0 it is not called \fBmain\fR anymore because it +is part of the Tk library and having a function \fBmain\fR +in a library (particularly a shared library) causes problems on many +systems. +Having \fBmain\fR in the Tk library would also make it hard to use +Tk in C++ programs, since C++ programs must have special C++ +\fBmain\fR functions. +.PP +Normally each application contains a small \fBmain\fR function that does +nothing but invoke \fBTk_Main\fR. +\fBTk_Main\fR then does all the work of creating and running a +\fBwish\fR-like application. +.PP +When it is has finished its own initialization, but before +it processes commands, \fBTk_Main\fR calls the procedure given by +the \fIappInitProc\fR argument. This procedure provides a ``hook'' +for the application to perform its own initialization, such as defining +application-specific commands. The procedure must have an interface +that matches the type \fBTcl_AppInitProc\fR: +.CS +typedef int Tcl_AppInitProc(Tcl_Interp *\fIinterp\fR); +.CE +\fIAppInitProc\fR is almost always a pointer to \fBTcl_AppInit\fR; +for more details on this procedure, see the documentation +for \fBTcl_AppInit\fR. + +.SH KEYWORDS +application-specific initialization, command-line arguments, main program |