?? crtwindow.3
字號:
'\"'\" 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.'\" '\" @(#) CrtWindow.c 1.21 96/11/01 09:42:20'\" .so man.macros.TH Tk_CreateWindow 3 4.2 Tk "Tk Library Procedures".BS.SH NAMETk_CreateWindow, Tk_CreateWindowFromPath, Tk_DestroyWindow, Tk_MakeWindowExist \- create or delete window.SH SYNOPSIS.nf\fB#include <tk.h>\fR.spTk_Window\fBTk_CreateWindow\fR(\fIinterp, parent, name, topLevScreen\fR).spTk_Window\fBTk_CreateWindowFromPath\fR(\fIinterp, tkwin, pathName, topLevScreen\fR).sp\fBTk_DestroyWindow\fR(\fItkwin\fR).sp\fBTk_MakeWindowExist\fR(\fItkwin\fR).SH ARGUMENTS.AS Tcl_Interp *topLevScreen.AP Tcl_Interp *interp outTcl interpreter to use for error reporting. If no error occurs,then \fI*interp\fR isn't modified..AP Tk_Window parent inToken for the window that is to serve as the logical parent ofthe new window..AP char *name inName to use for this window. Must be unique among all children ofthe same \fIparent\fR..AP char *topLevScreen inHas same format as \fIscreenName\fR. If NULL, then new window iscreated as an internal window. If non-NULL, new window is created asa top-level window on screen \fItopLevScreen\fR. If \fItopLevScreen\fRis an empty string (``'') then newwindow is created as top-level window of \fIparent\fR's screen..AP Tk_Window tkwin inToken for window..AP char *pathName inName of new window, specified as path name within application(e.g. \fB.a.b.c\fR)..BE.SH DESCRIPTION.PPThe procedures \fBTk_CreateWindow\fR.VSand \fBTk_CreateWindowFromPath\fRare used to create new windows foruse in Tk-based applications. Each of the procedures returns a tokenthat can be used to manipulate the window in other calls to the Tklibrary. If the window couldn't be created successfully, then NULLis returned and \fIinterp->result\fR is modified to hold an errormessage..PPTk supports two different kinds of windows: internalwindows and top-level windows..VEAn internal window is an interior window of a Tk application, such as ascrollbar or menu bar or button. A top-level window is one that iscreated as a child of a screen's root window, rather than as aninterior window, but which is logically part of some existing mainwindow. Examples of top-level windows are pop-up menus and dialog boxes..PPNew windows may be created by calling\fBTk_CreateWindow\fR. If the \fItopLevScreen\fR argument isNULL, then the new window will be an internal window. If\fItopLevScreen\fR is non-NULL, then the new window will be atop-level window: \fItopLevScreen\fR indicates the name ofa screen and the new window will be created as a child of theroot window of \fItopLevScreen\fR. In either case Tk willconsider the new window to be the logical child of \fIparent\fR:the new window's path name will reflect this fact, options maybe specified for the new window under this assumption, and so on.The only difference is that new X window for a top-level windowwill not be a child of \fIparent\fR's X window. For example, a pull-downmenu's \fIparent\fR 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 mighthave the application's main window as its parent..PP\fBTk_CreateWindowFromPath\fR offers an alternate way of specifyingnew windows. In \fBTk_CreateWindowFromPath\fR the newwindow is specified with a token for any window in the targetapplication (\fItkwin\fR), plus a path name for the new window.It produces the same effect as \fBTk_CreateWindow\fR and allowsboth top-level and internal windows to be created, depending onthe value of \fItopLevScreen\fR. In calls to \fBTk_CreateWindowFromPath\fR,as in calls to \fBTk_CreateWindow\fR, the parent of the new windowmust exist at the time of the call, but the new window must notalready exist..PPThe window creation procedures don'tactually issue the command to X to create a window.Instead, they create a local data structure associated withthe window and defer the creation of the X window.The window will actually be created by the first call to\fBTk_MapWindow\fR. Deferred window creation allows variousaspects of the window (such as its size, background color,etc.) to be modified after its creation without incurringany overhead in the X server. When the window is finallymapped all of the window attributes can be set while creatingthe window..PPThe value returned by a window-creation procedure is not theX token for the window (it can't be, since X hasn't beenasked to create the window yet). Instead, it is a tokenfor Tk's local data structure for the window. Mostof the Tk library procedures take Tk_Window tokens, ratherthan X identifiers. The actualX window identifier can be retrieved from the localdata structure using the \fBTk_WindowId\fR macro; seethe manual entry for \fBTk_WindowId\fR for details..PP\fBTk_DestroyWindow\fR deletes a window and all the datastructures associated with it, including any event handlerscreated with \fBTk_CreateEventHandler\fR. In addition,\fBTk_DestroyWindow\fR will delete any children of \fItkwin\fRrecursively (where children are defined in the Tk sense, consistingof all windows that were created with the given window as \fIparent\fR).If \fItkwin\fR was created by \fBTk_CreateInternalWindow\fR then eventhandlers interested in destroy eventsare invoked immediately. If \fItkwin\fR is a top-level or main window,then the event handlers will be invoked later, after X has seenthe request and returned an event for it..PPIf a window has been createdbut hasn't been mapped, so no X window exists, it ispossible to force the creation of the X window bycalling \fBTk_MakeWindowExist\fR. This procedure issuesthe X commands to instantiate the window given by \fItkwin\fR..SH KEYWORDScreate, deferred creation, destroy, display, internal window,screen, top-level window, window
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -