1Tk_CreateWindow(3)           Tk Library Procedures          Tk_CreateWindow(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tk_CreateWindow, Tk_CreateWindowFromPath, Tk_DestroyWindow, Tk_MakeWin‐
9       dowExist - create or delete window
10

SYNOPSIS

12       #include <tk.h>
13
14       Tk_Window
15       Tk_CreateWindow(interp, parent, name, topLevScreen)
16
17       Tk_Window
18       Tk_CreateAnonymousWindow(interp, parent, topLevScreen)
19
20       Tk_Window
21       Tk_CreateWindowFromPath(interp, tkwin, pathName, topLevScreen)
22
23       Tk_DestroyWindow(tkwin)
24
25       Tk_MakeWindowExist(tkwin)
26

ARGUMENTS

28       Tcl_Interp   *interp         (out)     Tcl interpreter to use for error
29                                              reporting.   If no error occurs,
30                                              then *interp isn't modified.
31
32       Tk_Window    parent          (in)      Token for the window that is  to
33                                              serve  as  the logical parent of
34                                              the new window.
35
36       CONST char   *name           (in)      Name to  use  for  this  window.
37                                              Must  be  unique among all chil‐
38                                              dren of the same parent.
39
40       CONST char   *topLevScreen   (in)      Has same format  as  screenName.
41                                              If NULL, then new window is cre‐
42                                              ated as an internal window.   If
43                                              non-NULL,  new window is created
44                                              as a top-level window on  screen
45                                              topLevScreen.   If  topLevScreen
46                                              is an empty string  (``'')  then
47                                              new  window  is  created as top-
48                                              level window of parent's screen.
49
50       Tk_Window    tkwin           (in)      Token for window.
51
52       CONST char   *pathName       (in)      Name of new window, specified as
53                                              path   name  within  application
54                                              (e.g. .a.b.c).
55_________________________________________________________________
56
57

DESCRIPTION

59       The procedures Tk_CreateWindow, Tk_CreateAnonymousWindow,  and  Tk_Cre‐ 
60       ateWindowFromPath  are  used  to create new windows for use in Tk-based │
61       applications.  Each of the procedures returns a token that can be  used │
62       to manipulate the window in other calls to the Tk library.  If the win‐ │
63       dow couldn't  be  created  successfully,  then  NULL  is  returned  and │
64       interp->result is modified to hold an error message.                    │
65
66       Tk  supports two different kinds of windows:  internal windows and top- │
67       level windows.  An internal window is an interior window of a Tk appli‐
68       cation,  such as a scrollbar or menu bar or button.  A top-level window
69       is one that is created as a child of a  screen's  root  window,  rather
70       than  as an interior window, but which is logically part of some exist‐
71       ing main window.  Examples of top-level windows are  pop-up  menus  and
72       dialog boxes.
73
74       New  windows  may  be  created  by  calling  Tk_CreateWindow.   If  the
75       topLevScreen argument is NULL, then the new window will be an  internal
76       window.   If  topLevScreen  is  non-NULL, then the new window will be a
77       top-level window: topLevScreen indicates the name of a screen  and  the
78       new  window  will  be  created  as  a  child  of  the  root  window  of
79       topLevScreen.  In either case Tk will consider the new window to be the
80       logical  child  of parent: the new window's path name will reflect this
81       fact, options may be specified for the new window  under  this  assump‐
82       tion,  and  so on.  The only difference is that new X window for a top-
83       level window will not be a child of parent's X window.  For example,  a
84       pull-down  menu's parent would be the button-like window used to invoke
85       it, which would in turn be a child of the menu bar  window.   A  dialog
86       box might have the application's main window as its parent.
87
88       Tk_CreateAnonymousWindow  differs  from Tk_CreateWindow in that it cre‐
89       ates an unnamed window.  This window will be manipulable only  using  C
90       interfaces, and will not be visible to Tcl scripts.  Both interior win‐
91       dows and top-level windows may be created  with  Tk_CreateAnonymousWin‐
92       dow.
93
94       Tk_CreateWindowFromPath  offers an alternate way of specifying new win‐
95       dows.  In Tk_CreateWindowFromPath the new window is  specified  with  a
96       token  for  any  window  in the target application (tkwin), plus a path
97       name for the new window.  It produces the same effect as  Tk_CreateWin‐
98       dow  and  allows  both  top-level  and  internal windows to be created,
99       depending on the value of  topLevScreen.   In  calls  to  Tk_CreateWin‐
100       dowFromPath, as in calls to Tk_CreateWindow, the parent of the new win‐
101       dow must exist at the time of the call, but the  new  window  must  not
102       already exist.
103
104       The window creation procedures don't actually issue the command to X to
105       create a window.  Instead, they create a local data  structure  associ‐
106       ated  with the window and defer the creation of the X window.  The win‐
107       dow will actually  be  created  by  the  first  call  to  Tk_MapWindow.
108       Deferred  window creation allows various aspects of the window (such as
109       its size, background color, etc.) to be  modified  after  its  creation
110       without  incurring  any  overhead  in the X server.  When the window is
111       finally mapped all of the window attributes can be set  while  creating
112       the window.
113
114       The  value  returned  by a window-creation procedure is not the X token
115       for the window (it can't be, since X hasn't been asked  to  create  the
116       window  yet).  Instead, it is a token for Tk's local data structure for
117       the window.  Most of the Tk library procedures take  Tk_Window  tokens,
118       rather  than  X  identifiers.   The  actual  X window identifier can be
119       retrieved from the local data structure using  the  Tk_WindowId  macro;
120       see the manual entry for Tk_WindowId for details.
121
122       Tk_DestroyWindow  deletes  a window and all the data structures associ‐
123       ated with it, including any event handlers created with  Tk_CreateEven‐
124       tHandler.   In  addition,  Tk_DestroyWindow will delete any children of
125       tkwin recursively (where children are defined in the Tk sense, consist‐
126       ing  of all windows that were created with the given window as parent).
127       If tkwin is an internal  window,  then  event  handlers  interested  in
128       destroy  events  are  invoked  immediately.  If tkwin is a top-level or
129       main window, then the event handlers will be invoked later, after X has
130       seen the request and returned an event for it.
131
132       If  a  window  has  been created but hasn't been mapped, so no X window
133       exists, it is possible to force the creation of the X window by calling
134       Tk_MakeWindowExist.   This procedure issues the X commands to instanti‐
135       ate the window given by tkwin.
136
137

KEYWORDS

139       create, deferred creation, destroy, display, internal  window,  screen,
140       top-level window, window
141
142
143
144Tk                                    4.2                   Tk_CreateWindow(3)
Impressum