CrtWindow.3
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:6k
- '"
- '" Copyright (c) 1990 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.
- '"
- '" RCS: @(#) $Id: CrtWindow.3,v 1.6 2002/08/05 04:30:38 dgp Exp $
- '"
- .so man.macros
- .TH Tk_CreateWindow 3 4.2 Tk "Tk Library Procedures"
- .BS
- .SH NAME
- Tk_CreateWindow, Tk_CreateWindowFromPath, Tk_DestroyWindow, Tk_MakeWindowExist - create or delete window
- .SH SYNOPSIS
- .nf
- fB#include <tk.h>fR
- .sp
- Tk_Window
- fBTk_CreateWindowfR(fIinterp, parent, name, topLevScreenfR)
- .sp
- Tk_Window
- fBTk_CreateAnonymousWindowfR(fIinterp, parent, topLevScreenfR)
- .sp
- Tk_Window
- fBTk_CreateWindowFromPathfR(fIinterp, tkwin, pathName, topLevScreenfR)
- .sp
- fBTk_DestroyWindowfR(fItkwinfR)
- .sp
- fBTk_MakeWindowExistfR(fItkwinfR)
- .SH ARGUMENTS
- .AS Tcl_Interp *topLevScreen
- .AP Tcl_Interp *interp out
- Tcl interpreter to use for error reporting. If no error occurs,
- then fI*interpfR isn't modified.
- .AP Tk_Window parent in
- Token for the window that is to serve as the logical parent of
- the new window.
- .AP "CONST char" *name in
- Name to use for this window. Must be unique among all children of
- the same fIparentfR.
- .AP "CONST char" *topLevScreen in
- Has same format as fIscreenNamefR. If NULL, then new window is
- created as an internal window. If non-NULL, new window is created as
- a top-level window on screen fItopLevScreenfR. If fItopLevScreenfR
- is an empty string (``'') then new
- window is created as top-level window of fIparentfR's screen.
- .AP Tk_Window tkwin in
- Token for window.
- .AP "CONST char" *pathName in
- Name of new window, specified as path name within application
- (e.g. fB.a.b.cfR).
- .BE
- .SH DESCRIPTION
- .PP
- The procedures fBTk_CreateWindowfR,
- .VS
- fBTk_CreateAnonymousWindowfR, and fBTk_CreateWindowFromPathfR
- are used to create new windows for
- use in Tk-based applications. Each of the procedures returns a token
- that can be used to manipulate the window in other calls to the Tk
- library. If the window couldn't be created successfully, then NULL
- is returned and fIinterp->resultfR is modified to hold an error
- message.
- .PP
- Tk supports two different kinds of windows: internal
- windows and top-level windows.
- .VE
- An internal window is an interior window of a Tk application, such as a
- scrollbar or menu bar or button. A top-level window is one that is
- created as a child of a screen's root window, rather than as an
- interior window, but which is logically part of some existing main
- window. Examples of top-level windows are pop-up menus and dialog boxes.
- .PP
- New windows may be created by calling
- fBTk_CreateWindowfR. If the fItopLevScreenfR argument is
- NULL, then the new window will be an internal window. If
- fItopLevScreenfR is non-NULL, then the new window will be a
- top-level window: fItopLevScreenfR indicates the name of
- a screen and the new window will be created as a child of the
- root window of fItopLevScreenfR. In either case Tk will
- consider the new window to be the logical child of fIparentfR:
- the new window's path name will reflect this fact, options may
- be specified for the new window under this assumption, and so on.
- The only difference is that new X window for a top-level window
- will not be a child of fIparentfR's X window. For example, a pull-down
- menu's fIparentfR would be the button-like window used to invoke it,
- which would in turn be a child of the menu bar window. A dialog box might
- have the application's main window as its parent.
- .PP
- fBTk_CreateAnonymousWindowfR differs from fBTk_CreateWindowfR in
- that it creates an unnamed window. This window will be manipulable
- only using C interfaces, and will not be visible to Tcl scripts. Both
- interior windows and top-level windows may be created with
- fBTk_CreateAnonymousWindowfR.
- .PP
- fBTk_CreateWindowFromPathfR offers an alternate way of specifying
- new windows. In fBTk_CreateWindowFromPathfR the new
- window is specified with a token for any window in the target
- application (fItkwinfR), plus a path name for the new window.
- It produces the same effect as fBTk_CreateWindowfR and allows
- both top-level and internal windows to be created, depending on
- the value of fItopLevScreenfR. In calls to fBTk_CreateWindowFromPathfR,
- as in calls to fBTk_CreateWindowfR, the parent of the new window
- must exist at the time of the call, but the new window must not
- already exist.
- .PP
- The window creation procedures don't
- actually issue the command to X to create a window.
- Instead, they create a local data structure associated with
- the window and defer the creation of the X window.
- The window will actually be created by the first call to
- fBTk_MapWindowfR. Deferred window creation allows various
- aspects of the window (such as its size, background color,
- etc.) to be modified after its creation without incurring
- any overhead in the X server. When the window is finally
- mapped all of the window attributes can be set while creating
- the window.
- .PP
- The value returned by a window-creation procedure is not the
- X token for the window (it can't be, since X hasn't been
- asked to create the window yet). Instead, it is a token
- for Tk's local data structure for the window. Most
- of the Tk library procedures take Tk_Window tokens, rather
- than X identifiers. The actual
- X window identifier can be retrieved from the local
- data structure using the fBTk_WindowIdfR macro; see
- the manual entry for fBTk_WindowIdfR for details.
- .PP
- fBTk_DestroyWindowfR deletes a window and all the data
- structures associated with it, including any event handlers
- created with fBTk_CreateEventHandlerfR. In addition,
- fBTk_DestroyWindowfR will delete any children of fItkwinfR
- recursively (where children are defined in the Tk sense, consisting
- of all windows that were created with the given window as fIparentfR).
- If fItkwinfR is an internal window, then event
- handlers interested in destroy events
- are invoked immediately. If fItkwinfR is a top-level or main window,
- then the event handlers will be invoked later, after X has seen
- the request and returned an event for it.
- .PP
- If a window has been created
- but hasn't been mapped, so no X window exists, it is
- possible to force the creation of the X window by
- calling fBTk_MakeWindowExistfR. This procedure issues
- the X commands to instantiate the window given by fItkwinfR.
- .SH KEYWORDS
- create, deferred creation, destroy, display, internal window,
- screen, top-level window, window