1message(n) Tk Built-In Commands message(n)
2
3
4
5______________________________________________________________________________
6
8 message - Create and manipulate 'message' non-interactive text widgets
9
11 message pathName ?options?
12
14 -anchor -background -borderwidth
15 -cursor -font -foreground
16 -highlightbackground -highlightcolor -highlightthickness
17 -padx -pady -relief
18 -takefocus -text -textvariable
19
20 See the options manual entry for details on the standard options.
21
23 Command-Line Name:-aspect
24 Database Name: aspect
25 Database Class: Aspect
26
27 Specifies a non-negative integer value indicating desired aspect
28 ratio for the text. The aspect ratio is specified as
29 100*width/height. 100 means the text should be as wide as it is
30 tall, 200 means the text should be twice as wide as it is tall,
31 50 means the text should be twice as tall as it is wide, and so
32 on. Used to choose line length for text if -width option is not
33 specified. Defaults to 150.
34
35 Command-Line Name:-justify
36 Database Name: justify
37 Database Class: Justify
38
39 Specifies how to justify lines of text. Must be one of left,
40 center, or right. Defaults to left. This option works together
41 with the -anchor, -aspect, -padx, -pady, and -width options to
42 provide a variety of arrangements of the text within the window.
43 The -aspect and -width options determine the amount of screen
44 space needed to display the text. The -anchor, -padx, and -pady
45 options determine where this rectangular area is displayed
46 within the widget's window, and the -justify option determines
47 how each line is displayed within that rectangular region. For
48 example, suppose -anchor is e and -justify is left, and that the
49 message window is much larger than needed for the text. The
50 text will be displayed so that the left edges of all the lines
51 line up and the right edge of the longest line is -padx from the
52 right side of the window; the entire text block will be cen‐
53 tered in the vertical span of the window.
54
55 Command-Line Name:-width
56 Database Name: width
57 Database Class: Width
58
59 Specifies the length of lines in the window. The value may have
60 any of the forms acceptable to Tk_GetPixels. If this option has
61 a value greater than zero then the -aspect option is ignored and
62 the -width option determines the line length. If this option
63 has a value less than or equal to zero, then the -aspect option
64 determines the line length.
65______________________________________________________________________________
66
68 The message command creates a new window (given by the pathName argu‐
69 ment) and makes it into a message widget. Additional options, de‐
70 scribed above, may be specified on the command line or in the option
71 database to configure aspects of the message such as its colors, font,
72 text, and initial relief. The message command returns its pathName ar‐
73 gument. At the time this command is invoked, there must not exist a
74 window named pathName, but pathName's parent must exist.
75
76 A message is a widget that displays a textual string. A message widget
77 has three special features that differentiate it from a label widget.
78 First, it breaks up its string into lines in order to produce a given
79 aspect ratio for the window. The line breaks are chosen at word bound‐
80 aries wherever possible (if not even a single word would fit on a line,
81 then the word will be split across lines). Newline characters in the
82 string will force line breaks; they can be used, for example, to leave
83 blank lines in the display.
84
85 The second feature of a message widget is justification. The text may
86 be displayed left-justified (each line starts at the left side of the
87 window), centered on a line-by-line basis, or right-justified (each
88 line ends at the right side of the window).
89
90 The third feature of a message widget is that it handles control char‐
91 acters and non-printing characters specially. Tab characters are re‐
92 placed with enough blank space to line up on the next 8-character
93 boundary. Newlines cause line breaks. Other control characters (ASCII
94 code less than 0x20) and characters not defined in the font are dis‐
95 played as a four-character sequence \xhh where hh is the two-digit
96 hexadecimal number corresponding to the character. In the unusual case
97 where the font does not contain all of the characters in
98 “0123456789abcdef\x” then control characters and undefined characters
99 are not displayed at all.
100
102 The message command creates a new Tcl command whose name is pathName.
103 This command may be used to invoke various operations on the widget.
104 It has the following general form:
105 pathName option ?arg arg ...?
106 Option and the args determine the exact behavior of the command. The
107 following commands are possible for message widgets:
108
109 pathName cget option
110 Returns the current value of the configuration option given by
111 option. Option may have any of the values accepted by the mes‐
112 sage command.
113
114 pathName configure ?option? ?value option value ...?
115 Query or modify the configuration options of the widget. If no
116 option is specified, returns a list describing all of the avail‐
117 able options for pathName (see Tk_ConfigureInfo for information
118 on the format of this list). If option is specified with no
119 value, then the command returns a list describing the one named
120 option (this list will be identical to the corresponding sublist
121 of the value returned if no option is specified). If one or
122 more option-value pairs are specified, then the command modifies
123 the given widget option(s) to have the given value(s); in this
124 case the command returns an empty string. Option may have any
125 of the values accepted by the message command.
126
128 When a new message is created, it has no default event bindings: mes‐
129 sages are intended for output purposes only.
130
132 Tabs do not work very well with text that is centered or right-justi‐
133 fied. The most common result is that the line is justified wrong.
134
136 label(n)
137
139 message, widget
140
141
142
143Tk 4.0 message(n)