messagebox - Create and manipulate a messagebox text widget

SYNOPSIS

messagebox pathName ?options?

INHERITANCE

itk::Widget <- Labeledwidget <- Scrolledwidget <- Messagebox

STANDARD OPTIONS

activeBackground
cursor
highlightColor
relief
activeForeground
exportSelection
highlightThickness
setGrid
background
font
padX
borderWidth
foreground
padY

See the "options" manual entry for details on the standard options.

ASSOCIATED OPTIONS

labelBitmap
labelPos
labelFont
labelText
labelImage
labelVariable
labelMargin

See the "labeledwidget" class manual entry for details on the above associated options.

activeRelief
elementBorderWidth
jump
troughColor

See the "scrollbar" widget manual entry for details on the above associated options.

height
textBackground
hscrollMode
visibleItems
sbWidth
vscrollMode
scrollMargin
width

See the "scrolledtext" widget manual entry for details on the above associated options.

spacing1
spacing2
spacing3

See the "text" widget manual entry for details on the above associated options.

WIDGET-SPECIFIC OPTIONS

Name:                   fileName
Class:                  FileName
Command-Line Switch:	-filename

Name:                   maxLines
Class:                  MaxLines
Command-Line Switch:	-maxlines

Name:                   saveDir
Class:                  SaveDir
Command-Line Switch:	-savedir


DESCRIPTION

The messagebox 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.

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.

MESSAGE TYPES

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:

-background color
Color specifies the background color to use for characters associated with the message type. It may have any of the forms accepted by Tk_GetColor.
-bell boolean
Specifies whether or not to ring the bell whenenver a message of this type is issued. Boolean may have any of the forms accepted by Tk_GetBoolean. The default is 0.
-font\ fontName
FontName is the name of a font to use for drawing characters. It may have any of the forms accepted by Tk_GetFontStruct.
-foreground color
Color specifies the foreground color to use for characters associated with the message type. It may have any of the forms accepted by Tk_GetColor.
-show boolean
Specifies whether of not to display this message type when issued. Boolean may have any of the forms accepted by Tk_GetBoolean. The default is 1.

METHODS

The messagebox command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:

pathName option ?arg arg ...?
Option and the args determine the exact behavior of the command. The following commands are possible for messagebox widgets:

WIDGET-SPECIFIC METHODS

pathName cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the messagebox command.
pathName clear
Clear the messagebox of all messages.
pathName export filename
Write text to a file. If filename exists then contents are replaced with text widget contents.
pathName configure ?option? ?value option value ...?
Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, 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 option is specified). If one or more option-value 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. Option may have any of the values accepted by the messagebox command.
pathName type option msgtype ?arg arg ...?
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:
pathName issue string ?level? ?tags?
Print a string to the text area at the given level and with any additional tags specified.

COMPONENTS

Name:                   itemMenu
Class:                  Menu

Name:                   text
Class:                  Scrolledtext

EXAMPLE

 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

AUTHOR

Alfredo Jahn V Mark L. Ulferts

KEYWORDS

messagebox, scrolledtext, text, widget