1Message(3) User Contributed Perl Documentation Message(3)
2
3
4
6 Tk::Message - Create and manipulate Message widgets
7
9 use Tk::Message;
10 ...
11 my $message = $parent->Message(
12 -text => 'somewhat long message text',
13 -aspect => 100,
14 -justify => 'left',
15 )->pack();
16
18 -anchor -font -highlightthickness -takefocus
19 -background -foreground -padx -text
20 -borderwidth -highlightbackground -pady -textvariable
21 -cursor -highlightcolor -relief -width
22
23 See Tk::options for details of the standard options.
24
26 Name: aspect
27 Class: Aspect
28 Switch: -aspect
29 Specifies a non-negative integer value indicating desired aspect
30 ratio for the text. The aspect ratio is specified as
31 100*width/height. 100 means the text should be as wide as it is
32 tall, 200 means the text should be twice as wide as it is tall, 50
33 means the text should be twice as tall as it is wide, and so on.
34 Used to choose line length for text if width option isn't
35 specified. Defaults to 150.
36
37 Name: justify
38 Class: Justify
39 Switch: -justify
40 Specifies how to justify lines of text. Must be one of left,
41 center, or right. Defaults to left. This option works together
42 with the anchor, aspect, padX, padY, and width options to provide a
43 variety of arrangements of the text within the window. The aspect
44 and width options determine the amount of screen space needed to
45 display the text. The anchor, padX, and padY options determine
46 where this rectangular area is displayed within the widget's
47 window, and the justify option determines how each line is
48 displayed within that rectangular region. For example, suppose
49 anchor is e and justify is left, and that the message window is
50 much larger than needed for the text. The the text will displayed
51 so that the left edges of all the lines line up and the right edge
52 of the longest line is padX from the right side of the window; the
53 entire text block will be centered in the vertical span of the
54 window.
55
56 Name: width
57 Class: Width
58 Switch: -width
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 a
61 value greater than zero then the aspect option is ignored and the
62 width option determines the line length. If this option has a
63 value less than or equal to zero, then the aspect option determines
64 the line length.
65
67 The Message method creates a new window (given by the $widget argument)
68 and makes it into a message widget. Additional options, described
69 above, may be specified on the command line or in the option database
70 to configure aspects of the message such as its colors, font, text, and
71 initial relief. The message command returns its $widget argument. At
72 the time this command is invoked, there must not exist a window named
73 $widget, but $widget's parent must exist.
74
75 A message is a widget that displays a textual string. A message widget
76 has three special features. First, it breaks up its string into lines
77 in order to produce a given aspect ratio for the window. The line
78 breaks are chosen at word boundaries wherever possible (if not even a
79 single word would fit on a line, then the word will be split across
80 lines). Newline characters in the string will force line breaks; they
81 can be used, for example, to leave blank lines in the display.
82
83 The second feature of a message widget is justification. The text may
84 be displayed left-justified (each line starts at the left side of the
85 window), centered on a line-by-line basis, or right-justified (each
86 line ends at the right side of the window).
87
88 The third feature of a message widget is that it handles control
89 characters and non-printing characters specially. Tab characters are
90 replaced with enough blank space to line up on the next 8-character
91 boundary. Newlines cause line breaks. Other control characters (ASCII
92 code less than 0x20) and characters not defined in the font are
93 displayed as a four-character sequence \xhh where hh is the two-digit
94 hexadecimal number corresponding to the character. In the unusual case
95 where the font doesn't contain all of the characters in
96 ``0123456789abcdef\x'' then control characters and undefined characters
97 are not displayed at all.
98
100 The Message method creates a widget object. This object supports the
101 configure and cget methods described in Tk::options which can be used
102 to enquire and modify the options described above. The widget also
103 inherits all the methods provided by the generic Tk::Widget class.
104
106 When a new message is created, it has no default event bindings:
107 messages are intended for output purposes only.
108
110 Tabs don't work very well with text that is centered or right-
111 justified. The most common result is that the line is justified wrong.
112
114 message, widget
115
116
117
118perl v5.36.0 2023-01-20 Message(3)