| 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>message (GCL TK Manual)</title> |
| 7 |
|
| 8 |
<meta name="description" content="message (GCL TK Manual)"> |
| 9 |
<meta name="keywords" content="message (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="frame.html" rel="next" title="frame"> |
| 17 |
<link href="entry.html" rel="prev" title="entry"> |
| 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="message"></span><div class="header"> |
| 42 |
<p> |
| 43 |
Next: <a href="frame.html" accesskey="n" rel="next">frame</a>, Previous: <a href="entry.html" accesskey="p" rel="prev">entry</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="message-1"></span><h3 class="section">2.11 message</h3> |
| 47 |
|
| 48 |
<p>message \- Create and manipulate message widgets |
| 49 |
</p><span id="Synopsis-10"></span><h4 class="unnumberedsubsec">Synopsis</h4> |
| 50 |
<p><b>message</b><i> </i><i>pathName </i><span class="roman">?</span><i>options</i>? |
| 51 |
</p><span id="Standard-Options-10"></span><h4 class="unnumberedsubsec">Standard Options</h4> |
| 52 |
|
| 53 |
|
| 54 |
<div class="example"> |
| 55 |
<pre class="example">anchor cursor padX text |
| 56 |
background font padY textVariable |
| 57 |
borderWidth foreground relief width |
| 58 |
</pre></div> |
| 59 |
|
| 60 |
|
| 61 |
<p>See <a href="options.html">options</a>, for more information. |
| 62 |
</p><span id="Arguments-for-Message"></span><h4 class="unnumberedsubsec">Arguments for Message</h4> |
| 63 |
|
| 64 |
|
| 65 |
<dl compact="compact"> |
| 66 |
<dt><code><b>:aspect</b></code></dt> |
| 67 |
<dd><p align="right">Name=<code>"<b>aspect</b><span class="roman">"</span> Class=<code>"</code><b>Aspect</b>"</code> |
| 68 |
</p><br> |
| 69 |
|
| 70 |
<p>Specifies a non-negative integer value indicating desired |
| 71 |
aspect ratio for the text. The aspect ratio is specified as |
| 72 |
100*width/height. 100 means the text should |
| 73 |
be as wide as it is tall, 200 means the text should |
| 74 |
be twice as wide as it is tall, 50 means the text should |
| 75 |
be twice as tall as it is wide, and so on. |
| 76 |
Used to choose line length for text if <b>width</b> option |
| 77 |
isn’t specified. |
| 78 |
Defaults to 150. |
| 79 |
</p></dd> |
| 80 |
</dl> |
| 81 |
|
| 82 |
|
| 83 |
<dl compact="compact"> |
| 84 |
<dt><code><b>:justify</b></code></dt> |
| 85 |
<dd><p align="right">Name=<code>"<b>justify</b><span class="roman">"</span> Class=<code>"</code><b>Justify</b>"</code> |
| 86 |
</p><br> |
| 87 |
|
| 88 |
<p>Specifies how to justify lines of text. |
| 89 |
Must be one of <b>left</b><span class="roman">, </span><b>center</b><span class="roman">, or </span><b>right</b>. Defaults |
| 90 |
to <b>left</b>. |
| 91 |
This option works together with the <b>anchor</b><span class="roman">, </span><b>aspect</b>, |
| 92 |
<b>padX</b><span class="roman">, </span><b>padY</b><span class="roman">, and </span><b>width</b> options to provide a variety |
| 93 |
of arrangements of the text within the window. |
| 94 |
The <b>aspect</b><span class="roman"> and </span><b>width</b> options determine the amount of |
| 95 |
screen space needed to display the text. |
| 96 |
The <b>anchor</b><span class="roman">, </span><b>padX</b><span class="roman">, and </span><b>padY</b> options determine where this |
| 97 |
rectangular area is displayed within the widget’s window, and the |
| 98 |
<b>justify</b> option determines how each line is displayed within that |
| 99 |
rectangular region. |
| 100 |
For example, suppose <b>anchor</b><span class="roman"> is </span><b>e</b><span class="roman"> and </span><b>justify</b> is |
| 101 |
<b>left</b>, and that the message window is much larger than needed |
| 102 |
for the text. |
| 103 |
The the text will displayed so that the left edges of all the lines |
| 104 |
line up and the right edge of the longest line is <b>padX</b> from |
| 105 |
the right side of the window; the entire text block will be centered |
| 106 |
in the vertical span of the window. |
| 107 |
</p></dd> |
| 108 |
</dl> |
| 109 |
|
| 110 |
|
| 111 |
<dl compact="compact"> |
| 112 |
<dt><code><b>:width</b></code></dt> |
| 113 |
<dd><p align="right">Name=<code>"<b>width</b><span class="roman">"</span> Class=<code>"</code><b>Width</b>"</code> |
| 114 |
</p><br> |
| 115 |
|
| 116 |
<p>Specifies the length of lines in the window. |
| 117 |
The value may have any of the forms acceptable to <b>Tk_GetPixels</b>. |
| 118 |
If this option has a value greater than zero then the <b>aspect</b> |
| 119 |
option is ignored and the <b>width</b> option determines the line |
| 120 |
length. |
| 121 |
If this option has a value less than or equal to zero, then |
| 122 |
the <b>aspect</b> option determines the line length. |
| 123 |
</p></dd> |
| 124 |
</dl> |
| 125 |
|
| 126 |
<span id="Description-7"></span><h4 class="unnumberedsubsec">Description</h4> |
| 127 |
|
| 128 |
<p>The <b>message</b> command creates a new window (given by the |
| 129 |
<i>pathName</i> argument) and makes it into a message widget. |
| 130 |
Additional |
| 131 |
options, described above, may be specified on the command line |
| 132 |
or in the option database |
| 133 |
to configure aspects of the message such as its colors, font, |
| 134 |
text, and initial relief. The <b>message</b> command returns its |
| 135 |
<i>pathName</i> argument. At the time this command is invoked, |
| 136 |
there must not exist a window named <i>pathName</i>, but |
| 137 |
<i>pathName</i>’s parent must exist. |
| 138 |
</p> |
| 139 |
<p>A message is a widget that displays a textual string. A message |
| 140 |
widget has three special features. First, it breaks up |
| 141 |
its string into lines in order to produce a given aspect ratio |
| 142 |
for the window. The line breaks are chosen at word boundaries |
| 143 |
wherever possible (if not even a single word would fit on a |
| 144 |
line, then the word will be split across lines). Newline characters |
| 145 |
in the string will force line breaks; they can be used, for example, |
| 146 |
to leave blank lines in the display. |
| 147 |
</p> |
| 148 |
<p>The second feature of a message widget is justification. The text |
| 149 |
may be displayed left-justified (each line starts at the left side of |
| 150 |
the window), centered on a line-by-line basis, or right-justified |
| 151 |
(each line ends at the right side of the window). |
| 152 |
</p> |
| 153 |
<p>The third feature of a message widget is that it handles control |
| 154 |
characters and non-printing characters specially. Tab characters |
| 155 |
are replaced with enough blank space to line up on the next |
| 156 |
8-character boundary. Newlines cause line breaks. Other control |
| 157 |
characters (ASCII code less than 0x20) and characters not defined |
| 158 |
in the font are displayed as a four-character sequence \fB\ex<i>hh</i> where |
| 159 |
<i>hh</i> is the two-digit hexadecimal number corresponding to |
| 160 |
the character. In the unusual case where the font doesn’t contain |
| 161 |
all of the characters in “0123456789abcdef\ex” then control |
| 162 |
characters and undefined characters are not displayed at all. |
| 163 |
</p> |
| 164 |
<span id="A-Message-Widget_0027s-Arguments"></span><h4 class="unnumberedsubsec">A Message Widget’s Arguments</h4> |
| 165 |
|
| 166 |
<p>The <b>message</b> command creates a new Tcl command whose |
| 167 |
name is <i>pathName</i>. This |
| 168 |
command may be used to invoke various |
| 169 |
operations on the widget. It has the following general form: |
| 170 |
</p> |
| 171 |
<div class="example"> |
| 172 |
<pre class="example"><i>pathName option </i><span class="roman">?</span><i>arg arg ...</i>? |
| 173 |
</pre></div> |
| 174 |
|
| 175 |
<p><i>Option</i><span class="roman"> and the </span><i>arg</i>s |
| 176 |
determine the exact behavior of the command. The following |
| 177 |
commands are possible for message widgets: |
| 178 |
</p> |
| 179 |
<dl compact="compact"> |
| 180 |
<dt><i>pathName </i><b>:configure</b><span class="roman"> ?</span><i>option</i><span class="roman">? ?</span><i>value option value ...</i>?</dt> |
| 181 |
<dd><p>Query or modify the configuration options of the widget. |
| 182 |
If no <i>option</i> is specified, returns a list describing all of |
| 183 |
the available options for <i>pathName</i><span class="roman"> (see </span><b>Tk_ConfigureInfo</b> for |
| 184 |
information on the format of this list). If <i>option</i> is specified |
| 185 |
with no <i>value</i>, then the command returns a list describing the |
| 186 |
one named option (this list will be identical to the corresponding |
| 187 |
sublist of the value returned if no <i>option</i> is specified). If |
| 188 |
one or more <i>option:value</i> pairs are specified, then the command |
| 189 |
modifies the given widget option(s) to have the given value(s); in |
| 190 |
this case the command returns an empty string. |
| 191 |
<i>Option</i><span class="roman"> may have any of the values accepted by the </span><b>message</b> |
| 192 |
command. |
| 193 |
</p> |
| 194 |
</dd> |
| 195 |
</dl> |
| 196 |
<span id="g_t_0022Default-Bindings_0022-4"></span><h4 class="unnumberedsubsec">"Default Bindings"</h4> |
| 197 |
|
| 198 |
<p>When a new message is created, it has no default event bindings: |
| 199 |
messages are intended for output purposes only. |
| 200 |
</p> |
| 201 |
<span id="Bugs-1"></span><h4 class="unnumberedsubsec">Bugs</h4> |
| 202 |
|
| 203 |
<p>Tabs don’t work very well with text that is centered or right-justified. |
| 204 |
The most common result is that the line is justified wrong. |
| 205 |
</p> |
| 206 |
<span id="Keywords-10"></span><h4 class="unnumberedsubsec">Keywords</h4> |
| 207 |
<p>message, widget |
| 208 |
</p><hr> |
| 209 |
<div class="header"> |
| 210 |
<p> |
| 211 |
Next: <a href="frame.html" accesskey="n" rel="next">frame</a>, Previous: <a href="entry.html" accesskey="p" rel="prev">entry</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> |
| 212 |
</div> |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
</body> |
| 217 |
</html> |