1iwidgets::messagebox − Create and manipulate a messagebox text
2widget iwidgets::messagebox pathName ?options? itk::Widget <‐
3iwidgets::Labeledwidget <‐ iwidgets::Scrolledwidget <‐ iwid‐
4gets::Messagebox
9See the "options" manual entry for details on the standard op‐
10tions.
13See the "labeledwidget" class manual entry for details on the
14above associated options.
16See the "scrollbar" widget manual entry for details on the above
17associated options.
20See the "scrolledtext" widget manual entry for details on the
21above associated options.
23See the "text" widget manual entry for details on the above asso‐
24ciated options.
25
26Name: fileName
27Class: FileName
28Command‐Line Switch: ‐filename
29Specifies the filename to be displayed in the file selection dia‐
30log when it pops up during a save of the messagebox contents op‐
31eration.
32Name: maxLines
33Class: MaxLines
34Command‐Line Switch: ‐maxlines
35Specifies the maximum number of lines allowed in the text area of
36the messagebox. When this limit is reached, the oldest line will
37be deleted such that the total number of lines remains maxlines.
38Name: saveDir
39Class: SaveDir
40Command‐Line Switch: ‐savedir
41Specifies the default directory to display when the file selec‐
42tion dialog pops up during a save of the messagebox contents op‐
43eration. If this parameter is not specified, then the files in
44the current working directory are displayed.
45
46The iwidgets::messagebox command creates a scrolled information
47messages area widget. Message types can be user defined and con‐
48figured. Their options include foreground, background, font,
49bell, and their display mode of on or off. This allows message
50types to defined as needed, removed when no longer so, and modi‐
51fied when necessary. An export method is provided for file I/O.
52
53The number of lines displayed may be limited with the default be‐
54ing 1000. When this limit is reached, the oldest line is removed.
55A popup menu which appears when the right mouse button has been
56pressed in the message area has been predefined. The contents of
57the popup menu by default support clearing the area and saving
58its contents to a file. Additional operations may be defined or
59existing operations removed by using the component command to ac‐
60cess the popup menu.
61
62The display characteristics of messages issued to the messagebox
63vary with the message type. Types are defined by the user and
64they may be added, removed, and configured. The options of the
65message type control the display include the following: −back‐
67characters associated with the message type. It may have any of
68the forms accepted by Tk_GetColor. −bell boolean Specifies
69whether or not to ring the bell whenenver a message of this type
70is issued. Boolean may have any of the forms accepted by Tk_Get‐
72of a font to use for drawing characters. It may have any of the
73forms accepted by Tk_GetFontStruct. −foreground color Color
74specifies the foreground color to use for characters associated
75with the message type. It may have any of the forms accepted by
77this message type when issued. Boolean may have any of the forms
78accepted by Tk_GetBoolean. The default is 1.
79
80The iwidgets::messagebox command creates a new Tcl command whose
81name is pathName. This command may be used to invoke various op‐
82erations on the widget. It has the following general form: path‐
84act behavior of the command. The following commands are possible
85for messagebox widgets:
86
88tion option given by option. Option may have any of the values
89accepted by the iwidgets::messagebox command. pathName clear
90Clear the messagebox of all messages. pathName export filename
91Write text to a file. If filename exists then contents are re‐
92placed with text widget contents. pathName configure ?option?
93?value option value ...? Query or modify the configuration op‐
94tions of the widget. If no option is specified, returns a list
95describing all of the available options for pathName (see Tk_Con‐
98describing the one named option (this list will be identical to
99the corresponding sublist of the value returned if no option is
100specified). If one or more option−value pairs are specified,
101then the command modifies the given widget option(s) to have the
102given value(s); in this case the command returns an empty
103string. Option may have any of the values accepted by the iwid‐
106behavior of the command depends on the option argument that fol‐
107lows the type keyword. The following forms of the command are
108supported: pathName type add msgtype ?option value ...? Adds a
109new message type given by msgtype with the display properties de‐
110fined by the option value pairs. See MESSAGE TYPES for informa‐
111tion on the options that are supported. pathName type cget msg‐
113message type. Msgtype identifies the message type, and option
114specifies a particular configuration option, which must be one of
115the ones listed in the section MESSAGE TYPES. pathName type con‐
117tion options for a message type. If no option is specified, re‐
118turns a list describing all of the available options for the mes‐
119sage type msgtype. If option is specified with no value, then
120the command returns a list describing the one named option. If
121one or more option−value pairs are specified, then the command
122modifies the given option(s) to have the given value(s); in this
123case the command returns an empty string. See MESSAGE TYPES for
124information on the options that are supported. pathName type re‐
127area at the given level and with any additional tags specified.
128
129Name: itemMenu
130Class: Menu
131This is the popup menu that gets displayed when you right‐click
132in the text area of the messagebox. Its contents may be modified
133via the component command.
134Name: text
135Class: Scrolledtext
136The text component is the scrolledtext widget. See the
137"scrolledtext" widget manual entry for details on the text compo‐
138nent item.
139
140 package require Iwidgets 4.0
141 iwidgets::messagebox .mb ‐hscrollmode dynamic \
142 ‐labeltext "Messages" ‐labelpos n \
143 ‐height 120 ‐width 550 ‐savedir "/tmp" ‐textbackground
144#d9d9d9
145
146 pack .mb ‐padx 5 ‐pady 5 ‐fill both ‐expand yes
147
148 .mb type add ERROR ‐background red ‐foreground white ‐bell 1
149 .mb type add WARNING ‐background yellow ‐foreground black
150 .mb type add INFO ‐background white ‐foreground black
151
152 .mb issue "This is an error message in red with a beep" ERROR
153 .mb issue "This warning message in yellow" WARNING
154 .mb issue "This is an informational message" INFO Alfredo Jahn V
155Mark L. Ulferts messagebox, scrolledtext, text, widget
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198