Debian Codegraph @

pod/Message.pod

raw
1 # Copyright (c) 1990-1994 The Regents of the University of California.
2 # Copyright (c) 1994-1996 Sun Microsystems, Inc.
3 # See the file "license.terms" for information on usage and redistribution
4 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
5 #
6 #
7
8 =head1 NAME
9
10 Tk::Message - Create and manipulate Message widgets
11
12 =for category Tk Widget Classes
13
14 =head1 SYNOPSIS
15
16 use Tk::Message;
17 ...
18 my $message = $parent->Message(
19 -text => 'somewhat long message text',
20 -aspect => 100,
21 -justify => 'left',
22 )->pack();
23
24 =head1 STANDARD OPTIONS
25
26 B<-anchor> B<-font> B<-highlightthickness> B<-takefocus>
27 B<-background> B<-foreground> B<-padx> B<-text>
28 B<-borderwidth> B<-highlightbackground> B<-pady> B<-textvariable>
29 B<-cursor> B<-highlightcolor> B<-relief> B<-width>
30
31 See L<Tk::options> for details of the standard options.
32
33 =head1 WIDGET-SPECIFIC OPTIONS
34
35 =over 4
36
37 =item Name: B<aspect>
38
39 =item Class: B<Aspect>
40
41 =item Switch: B<-aspect>
42
43 Specifies a non-negative integer value indicating desired
44 aspect ratio for the text. The aspect ratio is specified as
45 100*width/height. 100 means the text should
46 be as wide as it is tall, 200 means the text should
47 be twice as wide as it is tall, 50 means the text should
48 be twice as tall as it is wide, and so on.
49 Used to choose line length for text if B<width> option
50 isn't specified.
51 Defaults to 150.
52
53 =item Name: B<justify>
54
55 =item Class: B<Justify>
56
57 =item Switch: B<-justify>
58
59 Specifies how to justify lines of text.
60 Must be one of B<left>, B<center>, or B<right>. Defaults
61 to B<left>.
62 This option works together with the B<anchor>, B<aspect>,
63 B<padX>, B<padY>, and B<width> options to provide a variety
64 of arrangements of the text within the window.
65 The B<aspect> and B<width> options determine the amount of
66 screen space needed to display the text.
67 The B<anchor>, B<padX>, and B<padY> options determine where this
68 rectangular area is displayed within the widget's window, and the
69 B<justify> option determines how each line is displayed within that
70 rectangular region.
71 For example, suppose B<anchor> is B<e> and B<justify> is
72 B<left>, and that the message window is much larger than needed
73 for the text.
74 The the text will displayed so that the left edges of all the lines
75 line up and the right edge of the longest line is B<padX> from
76 the right side of the window; the entire text block will be centered
77 in the vertical span of the window.
78
79 =item Name: B<width>
80
81 =item Class: B<Width>
82
83 =item Switch: B<-width>
84
85 Specifies the length of lines in the window.
86 The value may have any of the forms acceptable to B<Tk_GetPixels>.
87 If this option has a value greater than zero then the B<aspect>
88 option is ignored and the B<width> option determines the line
89 length.
90 If this option has a value less than or equal to zero, then
91 the B<aspect> option determines the line length.
92
93 =back
94
95 =head1 DESCRIPTION
96
97 The B<Message> method creates a new window (given by the
98 $widget argument) and makes it into a message widget.
99 Additional
100 options, described above, may be specified on the command line
101 or in the option database
102 to configure aspects of the message such as its colors, font,
103 text, and initial relief. The B<message> command returns its
104 $widget argument. At the time this command is invoked,
105 there must not exist a window named $widget, but
106 $widget's parent must exist.
107
108 A message is a widget that displays a textual string. A message
109 widget has three special features. First, it breaks up
110 its string into lines in order to produce a given aspect ratio
111 for the window. The line breaks are chosen at word boundaries
112 wherever possible (if not even a single word would fit on a
113 line, then the word will be split across lines). Newline characters
114 in the string will force line breaks; they can be used, for example,
115 to leave blank lines in the display.
116
117 The second feature of a message widget is justification. The text
118 may be displayed left-justified (each line starts at the left side of
119 the window), centered on a line-by-line basis, or right-justified
120 (each line ends at the right side of the window).
121
122 The third feature of a message widget is that it handles control
123 characters and non-printing characters specially. Tab characters
124 are replaced with enough blank space to line up on the next
125 8-character boundary. Newlines cause line breaks. Other control
126 characters (ASCII code less than 0x20) and characters not defined
127 in the font are displayed as a four-character sequence B<\x>I<hh> where
128 I<hh> is the two-digit hexadecimal number corresponding to
129 the character. In the unusual case where the font doesn't contain
130 all of the characters in ``0123456789abcdef\x'' then control
131 characters and undefined characters are not displayed at all.
132
133 =head1 WIDGET METHODS
134
135 The B<Message> method creates a widget object.
136 This object supports the B<configure> and B<cget> methods
137 described in L<Tk::options> which can be used to enquire and
138 modify the options described above.
139 The widget also inherits all the methods provided by the generic
140 L<Tk::Widget|Tk::Widget> class.
141
142 =head1 DEFAULT BINDINGS
143
144 When a new message is created, it has no default event bindings:
145 messages are intended for output purposes only.
146
147 =head1 BUGS
148
149 Tabs don't work very well with text that is centered or right-justified.
150 The most common result is that the line is justified wrong.
151
152 =head1 KEYWORDS
153
154 message, widget
155
156 =cut
157