| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>toplevel (GCL TK Manual)</title> |
| 7 |
|
| 8 |
<meta name="description" content="toplevel (GCL TK Manual)"> |
| 9 |
<meta name="keywords" content="toplevel (GCL TK Manual)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="wm.html#SEC_Contents" rel="contents" title="Table of Contents"> |
| 15 |
<link href="Widgets.html" rel="up" title="Widgets"> |
| 16 |
<link href="Control.html" rel="next" title="Control"> |
| 17 |
<link href="radiobutton.html" rel="prev" title="radiobutton"> |
| 18 |
<style type="text/css"> |
| 19 |
<!-- |
| 20 |
a.summary-letter {text-decoration: none} |
| 21 |
blockquote.indentedblock {margin-right: 0em} |
| 22 |
div.display {margin-left: 3.2em} |
| 23 |
div.example {margin-left: 3.2em} |
| 24 |
div.lisp {margin-left: 3.2em} |
| 25 |
kbd {font-style: oblique} |
| 26 |
pre.display {font-family: inherit} |
| 27 |
pre.format {font-family: inherit} |
| 28 |
pre.menu-comment {font-family: serif} |
| 29 |
pre.menu-preformatted {font-family: serif} |
| 30 |
span.nolinebreak {white-space: nowrap} |
| 31 |
span.roman {font-family: initial; font-weight: normal} |
| 32 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 33 |
ul.no-bullet {list-style: none} |
| 34 |
--> |
| 35 |
</style> |
| 36 |
|
| 37 |
|
| 38 |
</head> |
| 39 |
|
| 40 |
<body lang="en"> |
| 41 |
<span id="toplevel"></span><div class="header"> |
| 42 |
<p> |
| 43 |
Previous: <a href="radiobutton.html" accesskey="p" rel="prev">radiobutton</a>, Up: <a href="Widgets.html" accesskey="u" rel="up">Widgets</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> |
| 44 |
</div> |
| 45 |
<hr> |
| 46 |
<span id="toplevel-1"></span><h3 class="section">2.15 toplevel</h3> |
| 47 |
|
| 48 |
<p>toplevel \- Create and manipulate toplevel widgets |
| 49 |
</p><span id="Synopsis-14"></span><h4 class="unnumberedsubsec">Synopsis</h4> |
| 50 |
<p><b>toplevel</b><i> </i><i>pathName </i><span class="roman">?</span><b>:screen </b><i>screenName</i><span class="roman">? ?</span><b>:class </b><i>className</i><span class="roman">? ?</span><i>options</i>? |
| 51 |
</p><span id="Standard-Options-14"></span><h4 class="unnumberedsubsec">Standard Options</h4> |
| 52 |
|
| 53 |
|
| 54 |
<div class="example"> |
| 55 |
<pre class="example">background geometry |
| 56 |
borderWidth relief |
| 57 |
</pre></div> |
| 58 |
|
| 59 |
|
| 60 |
<p>See <a href="options.html">options</a>, for more information. |
| 61 |
</p><span id="Arguments-for-Toplevel"></span><h4 class="unnumberedsubsec">Arguments for Toplevel</h4> |
| 62 |
|
| 63 |
<span id="Description-11"></span><h4 class="unnumberedsubsec">Description</h4> |
| 64 |
|
| 65 |
<p>The <b>toplevel</b> command creates a new toplevel widget (given |
| 66 |
by the <i>pathName</i> argument). Additional |
| 67 |
options, described above, may be specified on the command line |
| 68 |
or in the option database |
| 69 |
to configure aspects of the toplevel such as its background color |
| 70 |
and relief. The <b>toplevel</b> command returns the |
| 71 |
path name of the new window. |
| 72 |
</p> |
| 73 |
<p>A toplevel is similar to a frame except that it is created as a |
| 74 |
top-level window: its X parent is the root window of a screen |
| 75 |
rather than the logical parent from its path name. The primary |
| 76 |
purpose of a toplevel is to serve as a container for dialog boxes |
| 77 |
and other collections of widgets. The only features |
| 78 |
of a toplevel are its background color and an optional 3-D border |
| 79 |
to make the toplevel appear raised or sunken. |
| 80 |
</p> |
| 81 |
<p>Two special command-line options may be provided to the <b>toplevel</b> |
| 82 |
command: <b>:class</b><span class="roman"> and </span><b>:screen</b><span class="roman">. If </span><b>:class</b> |
| 83 |
is specified, then the new widget’s class will be set to |
| 84 |
<i>className</i><span class="roman"> instead of </span><b>Toplevel</b>. Changing the class of |
| 85 |
a toplevel widget may be useful |
| 86 |
in order to use a special class name in database options referring |
| 87 |
to this widget and its children. The <b>:screen</b> option |
| 88 |
may be used to place the window on a different screen than the |
| 89 |
window’s logical parent. Any valid screen name may be used, even |
| 90 |
one associated with a different display. |
| 91 |
</p> |
| 92 |
<p>Note: <b>:class</b><span class="roman"> and </span><b>:screen</b> are handled |
| 93 |
differently than other command-line options. They may not be specified |
| 94 |
using the option database (these options must have been processed |
| 95 |
before the new window has been created enough to use the option database; |
| 96 |
in particular, the new class name will affect the lookup of options |
| 97 |
in the database). In addition, <b>:class</b><span class="roman"> and </span><b>:screen</b> |
| 98 |
may not be queried or changed using the <b>config</b> command described |
| 99 |
below. However, the <b>winfo :class</b> command may be used to query |
| 100 |
the class of a window, and <b>winfo :screen</b> may be used to query |
| 101 |
its screen. |
| 102 |
</p> |
| 103 |
<span id="A-Toplevel-Widget_0027s-Arguments"></span><h4 class="unnumberedsubsec">A Toplevel Widget’s Arguments</h4> |
| 104 |
|
| 105 |
<p>The <b>toplevel</b> command creates a new Tcl command whose |
| 106 |
name is the same as the path name of the toplevel’s window. This |
| 107 |
command may be used to invoke various |
| 108 |
operations on the widget. It has the following general form: |
| 109 |
</p> |
| 110 |
<div class="example"> |
| 111 |
<pre class="example"><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>? |
| 112 |
</pre></div> |
| 113 |
|
| 114 |
<p><i>PathName</i> is the name of the command, which is the same as |
| 115 |
the toplevel widget’s path name. <i>Option</i><span class="roman"> and the </span><i>arg</i>s |
| 116 |
determine the exact behavior of the command. The following |
| 117 |
commands are possible for toplevel widgets: |
| 118 |
</p> |
| 119 |
<dl compact="compact"> |
| 120 |
<dt><i>pathName </i><b>:configure</b><span class="roman"> ?</span><i>option</i><span class="roman">? ?</span><i>value option value ...</i>?</dt> |
| 121 |
<dd><p>Query or modify the configuration options of the widget. |
| 122 |
If no <i>option</i> is specified, returns a list describing all of |
| 123 |
the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for |
| 124 |
information on the format of this list). If <i>option</i> is specified |
| 125 |
with no <i>value</i>, then the command returns a list describing the |
| 126 |
one named option (this list will be identical to the corresponding |
| 127 |
sublist of the value returned if no <i>option</i> is specified). If |
| 128 |
one or more <i>option:value</i> pairs are specified, then the command |
| 129 |
modifies the given widget option(s) to have the given value(s); in |
| 130 |
this case the command returns an empty string. |
| 131 |
<i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>toplevel</b> |
| 132 |
command. |
| 133 |
</p> |
| 134 |
</dd> |
| 135 |
</dl> |
| 136 |
<span id="Bindings-8"></span><h4 class="unnumberedsubsec">Bindings</h4> |
| 137 |
|
| 138 |
<p>When a new toplevel is created, it has no default event bindings: |
| 139 |
toplevels are not intended to be interactive. |
| 140 |
</p> |
| 141 |
<span id="Keywords-14"></span><h4 class="unnumberedsubsec">Keywords</h4> |
| 142 |
<p>toplevel, widget |
| 143 |
</p> |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
<hr> |
| 148 |
<div class="header"> |
| 149 |
<p> |
| 150 |
Previous: <a href="radiobutton.html" accesskey="p" rel="prev">radiobutton</a>, Up: <a href="Widgets.html" accesskey="u" rel="up">Widgets</a> [<a href="wm.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> |
| 151 |
</div> |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
</body> |
| 156 |
</html> |