You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
359 lines
10 KiB
HTML
359 lines
10 KiB
HTML
<TITLE>messagebox - Create and manipulate a messagebox text widget</TITLE>
|
|
<H1>messagebox - Create and manipulate a messagebox text widget</H1>
|
|
|
|
</pre><H2>SYNOPSIS</H2>
|
|
<B>messagebox<I> <I>pathName </I>?<I>options</I>?
|
|
</pre><H2>INHERITANCE</H2>
|
|
itk::Widget <- Labeledwidget <- Scrolledwidget <- Messagebox
|
|
</pre><H2>STANDARD OPTIONS</H2>
|
|
<P>
|
|
<table cellpadding=5>
|
|
<td valign=top>
|
|
<B>activeBackground</B><br>
|
|
<B>cursor</B><br>
|
|
<B>highlightColor</B><br>
|
|
<B>relief</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>activeForeground</B><br>
|
|
<B>exportSelection</B><br>
|
|
<B>highlightThickness</B><br>
|
|
<B>setGrid</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>background</B><br>
|
|
<B>font</B><br>
|
|
<B>padX</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>borderWidth</B><br>
|
|
<B>foreground</B><br>
|
|
<B>padY</B><br>
|
|
</td>
|
|
</table>
|
|
<P>
|
|
See the <A HREF="http://www.sco.com/Technology/tcl/man/tk_man/options.n.html"> "options" </A> manual entry for details on the standard options.
|
|
</pre><H2>ASSOCIATED OPTIONS</H2>
|
|
<P>
|
|
<table cellpadding=5>
|
|
<td valign=top>
|
|
<B>labelBitmap</B><br>
|
|
<B>labelPos</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>labelFont</B><br>
|
|
<B>labelText</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>labelImage</B><br>
|
|
<B>labelVariable</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>labelMargin</B><br>
|
|
</td>
|
|
</table>
|
|
<P>
|
|
See the <A HREF="labeledwidget.n.html"> "labeledwidget" </A> class manual entry for details on the above
|
|
associated options.
|
|
<P>
|
|
<table cellpadding=5>
|
|
<td valign=top>
|
|
<B>activeRelief</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>elementBorderWidth</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>jump</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>troughColor</B><br>
|
|
</td>
|
|
</table>
|
|
<P>
|
|
See the <A HREF="http://www.sco.com/Technology/tcl/man/tk_man/scrollbar.n.html"> "scrollbar" </A> widget manual entry for details on the above
|
|
associated options.
|
|
<P>
|
|
<table cellpadding=5>
|
|
<td valign=top>
|
|
<B>height</B><br>
|
|
<B>textBackground</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>hscrollMode</B><br>
|
|
<B>visibleItems</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>sbWidth</B><br>
|
|
<B>vscrollMode</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>scrollMargin</B><br>
|
|
<B>width</B><br>
|
|
</td>
|
|
</table>
|
|
<P>
|
|
See the <A HREF="scrolledtext.n.html"> "scrolledtext" </A> widget manual entry for details on the above
|
|
associated options.
|
|
<P>
|
|
<table cellpadding=5>
|
|
<td valign=top>
|
|
<B>spacing1</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>spacing2</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
<B>spacing3</B><br>
|
|
</td>
|
|
<td valign=top>
|
|
</td>
|
|
</table>
|
|
<P>
|
|
See the <A HREF="http://www.sco.com/Technology/tcl/man/tk_man/text.n.html"> "text" </A> widget manual entry for details on the above
|
|
associated options.
|
|
|
|
</pre><H2>WIDGET-SPECIFIC OPTIONS</H2>
|
|
<P>
|
|
<pre>
|
|
Name: <B>fileName</B>
|
|
Class: <B>FileName</B>
|
|
Command-Line Switch: <B>-filename</B>
|
|
</pre>
|
|
<UL>
|
|
Specifies the filename to be displayed in the file selection dialog when
|
|
it pops up during a save of the messagebox contents operation.
|
|
</UL>
|
|
<P>
|
|
<pre>
|
|
Name: <B>maxLines</B>
|
|
Class: <B>MaxLines</B>
|
|
Command-Line Switch: <B>-maxlines</B>
|
|
</pre>
|
|
<UL>
|
|
Specifies the maximum number of lines allowed in the text area of the
|
|
messagebox. When this limit is reached, the oldest line will be deleted
|
|
such that the total number of lines remains <I>maxlines</I>.
|
|
</UL>
|
|
<P>
|
|
<pre>
|
|
Name: <B>saveDir</B>
|
|
Class: <B>SaveDir</B>
|
|
Command-Line Switch: <B>-savedir</B>
|
|
</pre>
|
|
<UL>
|
|
Specifies the default directory to display when the file selection dialog
|
|
pops up during a save of the messagebox contents operation. If this
|
|
parameter is not specified, then the files in the current working directory
|
|
are displayed.
|
|
</UL>
|
|
<P>
|
|
</pre><HR>
|
|
|
|
</pre><H2>DESCRIPTION</H2>
|
|
<P>
|
|
The <B>messagebox</B> command creates
|
|
a scrolled information messages area widget.
|
|
Message types can be user defined and configured. Their options
|
|
include foreground, background, font, bell, and their display
|
|
mode of on or off. This allows message types to defined as needed,
|
|
removed when no longer so, and modified when necessary. An export
|
|
method is provided for file I/O.
|
|
|
|
<P>
|
|
The number of lines displayed may be limited with
|
|
the default being 1000. When this limit is reached, the oldest line
|
|
is removed. A popup menu which appears when the right mouse button
|
|
has been pressed in the message area has been predefined. The contents
|
|
of the popup menu by default support clearing the area and saving its
|
|
contents to a file. Additional operations may be defined or existing
|
|
operations removed by using the component command to access the
|
|
popup menu.
|
|
|
|
</pre><H2>MESSAGE TYPES</H2>
|
|
<P>
|
|
The display characteristics of messages issued to the messagebox vary
|
|
with the message type. Types are defined by the user and they may
|
|
be added, removed, and configured. The options of the message type
|
|
control the display include the following:
|
|
<DL>
|
|
<DT> <B>-background <I>color</I>
|
|
</I></B>
|
|
<DD> <I>Color</I> specifies the background color to use for characters
|
|
associated with the message type.
|
|
It may have any of the forms accepted by <B>Tk_GetColor</B>.
|
|
</DL>
|
|
<DL>
|
|
<DT> <B>-bell <I>boolean</I>
|
|
</I></B>
|
|
<DD> Specifies whether or not to ring the bell whenenver a message of this
|
|
type is issued. <I>Boolean</I> may have any of the forms accepted by
|
|
<B>Tk_GetBoolean</B>. The default is 0.
|
|
</DL>
|
|
<DL>
|
|
<DT> <B>-font\ <I>fontName</I>
|
|
</I></B>
|
|
<DD> <I>FontName</I> is the name of a font to use for drawing
|
|
characters. It may have any of the forms accepted
|
|
by Tk_GetFontStruct.
|
|
</DL>
|
|
<DL>
|
|
<DT> <B>-foreground <I>color</I>
|
|
</I></B>
|
|
<DD> <I>Color</I> specifies the foreground color to use for characters
|
|
associated with the message type.
|
|
It may have any of the forms accepted by <B>Tk_GetColor</B>.
|
|
</DL>
|
|
<DL>
|
|
<DT> <B>-show <I>boolean</I>
|
|
</I></B>
|
|
<DD> Specifies whether of not to display this message type when issued.
|
|
<I>Boolean</I> may have any of the forms accepted by
|
|
<B>Tk_GetBoolean</B>. The default is 1.
|
|
|
|
</DL>
|
|
</pre><H2>METHODS</H2>
|
|
<P>
|
|
The <B>messagebox</B> command creates a new Tcl command whose
|
|
name is <I>pathName</I>. This
|
|
command may be used to invoke various
|
|
operations on the widget. It has the following general form:
|
|
<pre>
|
|
<I>pathName option </I>?<I>arg arg ...</I>?
|
|
</pre>
|
|
<I>Option</I> and the <I>arg</I>s
|
|
determine the exact behavior of the command. The following
|
|
commands are possible for messagebox widgets:
|
|
|
|
</pre><H2>WIDGET-SPECIFIC METHODS</H2>
|
|
<DL>
|
|
<DT> <I>pathName <B>cget</B> <I>option</I>
|
|
</I></B>
|
|
<DD> Returns the current value of the configuration option given
|
|
by <I>option</I>.
|
|
<I>Option</I> may have any of the values accepted by the <B>messagebox</B>
|
|
command.
|
|
</DL>
|
|
<DL>
|
|
<DT> <I>pathName <B>clear</B>
|
|
</I></B>
|
|
<DD> Clear the messagebox of all messages.
|
|
</DL>
|
|
<DL>
|
|
<DT> <I>pathName <B>export</B> <I>filename</I>
|
|
</I></B>
|
|
<DD> Write text to a file. If <I>filename</I> exists then
|
|
contents are replaced with text widget contents.
|
|
</DL>
|
|
<DL>
|
|
<DT> <I>pathName</I> <B>configure</B> ?<I>option</I>? ?<I>value option value ...</I>?
|
|
</I></B>
|
|
<DD> Query or modify the configuration options of the widget.
|
|
If no <I>option</I> is specified, returns a list describing all of
|
|
the available options for <I>pathName</I> (see <B>Tk_ConfigureInfo</B> for
|
|
information on the format of this list). If <I>option</I> is specified
|
|
with no <I>value</I>, then the command returns a list describing the
|
|
one named option (this list will be identical to the corresponding
|
|
sublist of the value returned if no <I>option</I> is specified). If
|
|
one or more <I>option-value</I> pairs are specified, then the command
|
|
modifies the given widget option(s) to have the given value(s); in
|
|
this case the command returns an empty string.
|
|
<I>Option</I> may have any of the values accepted by the <B>messagebox</B>
|
|
command.
|
|
</DL>
|
|
<DL>
|
|
<DT> <I>pathName <B>type</B> <I>option</I> <I>msgtype</I> ?<I>arg arg ...</I>?
|
|
</I></B>
|
|
<DD> This command is used to manipulate message types. The behavior of
|
|
the command depends on the option argument that follows the type keyword.
|
|
The following forms of the command are supported:
|
|
</DL>
|
|
<UL>
|
|
<DL>
|
|
</DL>
|
|
<DL>
|
|
<DT> <I>pathName <B>type add</B> <I>msgtype</I> ?<I>option value ...</I>?
|
|
</I></B>
|
|
<DD> Adds a new message type given by <I>msgtype</I> with the display
|
|
properties defined by the option value pairs.
|
|
See MESSAGE TYPES for information on the options that
|
|
are supported.
|
|
</DL>
|
|
<DL>
|
|
<DT> <I>pathName <B>type cget</B> <I>msgtype option</I>
|
|
</I></B>
|
|
<DD> Returns the value of a configuration option for a message type.
|
|
<I>Msgtype</I> identifies the message type, and <I>option</I>
|
|
specifies a particular configuration option, which must be one of
|
|
the ones listed in the section MESSAGE TYPES.
|
|
</DL>
|
|
<DL>
|
|
<DT> <I>pathName <B>type configure <I>msgtype</I> ?<I>option value ...</I>?
|
|
</I></B>
|
|
<DD> Query or modify the configuration options for a message type.
|
|
If no <I>option</I> is specified, returns a list describing all of
|
|
the available options for the message type <I>msgtype</I>.
|
|
If <I>option</I> is specified with no <I>value</I>, then the command
|
|
returns a list describing the one named option.
|
|
If one or more <I>option-value</I> pairs are specified, then the command
|
|
modifies the given option(s) to have the given value(s); in
|
|
this case the command returns an empty string.
|
|
See MESSAGE TYPES for information on the options that
|
|
are supported.
|
|
<I>pathName <B>type remove</B> <I>msgtype</I>
|
|
Removes an existing message type given by <I>msgtype</I>.
|
|
</DL>
|
|
</UL>
|
|
<DL>
|
|
<DT> <I>pathName <B>issue</B> <I>string</I> <I>?level?</I> <I>?tags?</I>
|
|
</I></B>
|
|
<DD> Print a <I>string</I> to the text area at the given level and with
|
|
any additional tags specified.
|
|
|
|
</DL>
|
|
</pre><H2>COMPONENTS</H2>
|
|
<P>
|
|
<pre>
|
|
Name: <B>itemMenu</B>
|
|
Class: <B>Menu</B>
|
|
</pre>
|
|
<UL>
|
|
This is the popup menu that gets displayed when you right-click in the
|
|
text area of the messagebox. Its contents may be modified via the component
|
|
command.
|
|
</UL>
|
|
<P>
|
|
<pre>
|
|
Name: <B>text</B>
|
|
Class: <B>Scrolledtext</B>
|
|
</pre>
|
|
<UL>
|
|
The text component is the scrolledtext widget. See the "scrolledtext" widget
|
|
manual entry for details on the text component item.
|
|
</UL>
|
|
</table>
|
|
|
|
</pre><H2>EXAMPLE</H2>
|
|
<pre>
|
|
messagebox .mb -hscrollmode dynamic -labeltext "Messages" -labelpos n \\
|
|
-height 120 -width 550 -savedir "/tmp" -textbackground #d9d9d9
|
|
|
|
pack .mb -padx 5 -pady 5 -fill both -expand yes
|
|
|
|
.mb type add ERROR -background red -foreground white -bell 1
|
|
.mb type add WARNING -background yellow -foreground black
|
|
.mb type add INFO -background white -foreground black
|
|
|
|
.mb issue "This is an error message in red with a beep" ERROR
|
|
.mb issue "This warning message in yellow" WARNING
|
|
.mb issue "This is an informational message" INFO
|
|
</pre>
|
|
</pre><H2>AUTHORS</H2>
|
|
Alfredo Jahn V
|
|
<P>
|
|
Mark L. Ulferts
|
|
<P>
|
|
</pre><H2>KEYWORDS</H2>
|
|
messagebox, scrolledtext, text, widget
|
|
|