📄 messagebox.n
字号:
'\"'\" Copyright (c) 1995 DSC Technologies Corporation'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\"'\" @(#) scrolledtext.n 1.21 94/12/17 16:04:44'/" .so man.macros.HS messagebox iwid.BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEmessagebox \- Create and manipulate a messagebox text widget.SH SYNOPSIS\fBmessagebox\fI \fIpathName \fR?\fIoptions\fR?.SH "INHERITANCE"itk::Widget <- Labeledwidget <- Scrolledwidget <- Messagebox.SH "STANDARD OPTIONS".LP.nf.ta 4c 8c 12c\fBactiveBackground\fR \fBactiveForeground\fR \fBbackground\fR \fBborderWidth\fR\fBcursor\fR \fBexportSelection\fR \fBfont\fR \fBforeground\fR\fBhighlightColor\fR \fBhighlightThickness\fR \fBpadX\fR \fBpadY\fR\fBrelief\fR \fBsetGrid\fR.fi.LPSee the "options" manual entry for details on the standard options..SH "ASSOCIATED OPTIONS".LP.nf.ta 4c 8c 12c\fBlabelBitmap\fR \fBlabelFont\fR \fBlabelImage\fR \fBlabelMargin\fR\fBlabelPos\fR \fBlabelText\fR \fBlabelVariable\fR.fi.LPSee the "labeledwidget" class manual entry for details on the aboveassociated options..LP.nf.ta 4c 8c 12c\fBactiveRelief\fR \fBelementBorderWidth\fR \fBjump\fR \fBtroughColor\fR.fi.LPSee the "scrollbar" widget manual entry for details on the aboveassociated options..LP.nf.ta 4c 8c 12c\fBheight\fR \fBhscrollMode\fR \fBsbWidth\fR \fBscrollMargin\fR\fBtextBackground\fR \fBvisibleItems\fR \fBvscrollMode\fR \fBwidth\fR.fi.LPSee the "scrolledtext" widget manual entry for details on the aboveassociated options..LP.nf.ta 4c 8c 12c\fBspacing1\fR \fBspacing2\fR \fBspacing3\fR.fi.LPSee the "text" widget manual entry for details on the aboveassociated options..SH "WIDGET-SPECIFIC OPTIONS".LP.nfName: \fBfileName\fRClass: \fBFileName\fRCommand-Line Switch: \fB-filename\fR.fi.IPSpecifies the filename to be displayed in the file selection dialog when it pops up during a save of the messagebox contents operation..LP.nfName: \fBmaxLines\fRClass: \fBMaxLines\fRCommand-Line Switch: \fB-maxlines\fR.fi.IPSpecifies 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 \fImaxlines\fR..LP.nfName: \fBsaveDir\fRClass: \fBSaveDir\fRCommand-Line Switch: \fB-savedir\fR.fi.IPSpecifies 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..LP.BE.SH DESCRIPTION.PPThe \fBmessagebox\fR command creates a scrolled information messages area widget.Message types can be user defined and configured. Their optionsinclude foreground, background, font, bell, and their displaymode of on or off. This allows message types to defined as needed,removed when no longer so, and modified when necessary. An exportmethod is provided for file I/O..PPThe number of lines displayed may be limited withthe default being 1000. When this limit is reached, the oldest line is removed. A popup menu which appears when the right mouse buttonhas been pressed in the message area has been predefined. The contentsof the popup menu by default support clearing the area and saving itscontents to a file. Additional operations may be defined or existingoperations removed by using the component command to access the popup menu..SH "MESSAGE TYPES".PPThe display characteristics of messages issued to the messagebox varywith the message type. Types are defined by the user and they maybe added, removed, and configured. The options of the message typecontrol the display include the following:.TP\fB\-background \fIcolor\fR\fIColor\fR specifies the background color to use for charactersassociated with the message type.It may have any of the forms accepted by \fBTk_GetColor\fR..TP\fB\-bell \fIboolean\fRSpecifies whether or not to ring the bell whenenver a message of thistype is issued. \fIBoolean\fR may have any of the forms accepted by \fBTk_GetBoolean\fR. The default is 0..TP\fB-font\ \fIfontName\fR\fIFontName\fR is the name of a font to use for drawingcharacters. It may have any of the forms acceptedby Tk_GetFontStruct..TP\fB\-foreground \fIcolor\fR\fIColor\fR specifies the foreground color to use for charactersassociated with the message type.It may have any of the forms accepted by \fBTk_GetColor\fR..TP\fB\-show \fIboolean\fRSpecifies whether of not to display this message type when issued.\fIBoolean\fR may have any of the forms accepted by \fBTk_GetBoolean\fR. The default is 1..SH "METHODS".PPThe \fBmessagebox\fR command creates a new Tcl command whosename is \fIpathName\fR. Thiscommand may be used to invoke variousoperations on the widget. It has the following general form:.DS C\fIpathName option \fR?\fIarg arg ...\fR?.DE\fIOption\fR and the \fIarg\fRsdetermine the exact behavior of the command. The followingcommands are possible for messagebox widgets:.SH "WIDGET-SPECIFIC METHODS".TP\fIpathName \fBcget\fR \fIoption\fRReturns the current value of the configuration option givenby \fIoption\fR.\fIOption\fR may have any of the values accepted by the \fBmessagebox\fRcommand..TP\fIpathName \fBclear\fRClear the messagebox of all messages..TP\fIpathName \fBexport\fR \fIfilename\fRWrite text to a file. If \fIfilename\fR exists thencontents are replaced with text widget contents..TP\fIpathName\fR \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR?Query or modify the configuration options of the widget.If no \fIoption\fR is specified, returns a list describing all ofthe available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR forinformation on the format of this list). If \fIoption\fR is specifiedwith no \fIvalue\fR, then the command returns a list describing theone named option (this list will be identical to the correspondingsublist of the value returned if no \fIoption\fR is specified). Ifone or more \fIoption\-value\fR pairs are specified, then the commandmodifies the given widget option(s) to have the given value(s); inthis case the command returns an empty string.\fIOption\fR may have any of the values accepted by the \fBmessagebox\fRcommand..TP\fIpathName \fBtype\fR \fIoption\fR \fImsgtype\fR ?\fIarg arg ...\fR?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:.RS.TP.TP\fIpathName \fBtype add\fR \fImsgtype\fR ?\fIoption value ...\fR?Adds a new message type given by \fImsgtype\fR with the displayproperties defined by the option value pairs. See MESSAGE TYPES for information on the options thatare supported..TP\fIpathName \fBtype cget\fR \fImsgtype option\fRReturns the value of a configuration option for a message type.\fIMsgtype\fR identifies the message type, and \fIoption\fRspecifies a particular configuration option, which must be one ofthe ones listed in the section MESSAGE TYPES..TP\fIpathName \fBtype configure \fImsgtype\fR ?\fIoption value ...\fR?Query or modify the configuration options for a message type.If no \fIoption\fR is specified, returns a list describing all ofthe available options for the message type \fImsgtype\fR.If \fIoption\fR is specified with no \fIvalue\fR, then the commandreturns a list describing the one named option.If one or more \fIoption\-value\fR pairs are specified, then the commandmodifies the given option(s) to have the given value(s); inthis case the command returns an empty string.See MESSAGE TYPES for information on the options thatare supported.\fIpathName \fBtype remove\fR \fImsgtype\fR Removes an existing message type given by \fImsgtype\fR..RE.TP\fIpathName \fBissue\fR \fIstring\fR \fI?level?\fR \fI?tags?\fRPrint a \fIstring\fR to the text area at the given level and withany additional tags specified..SH "COMPONENTS".LP.nfName: \fBitemMenu\fRClass: \fBMenu\fR.fi.IPThis 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 componentcommand..LP.nfName: \fBtext\fRClass: \fBScrolledtext\fR.fi.IPThe text component is the scrolledtext widget. See the "scrolledtext" widget manual entry for details on the text component item..fi.SH EXAMPLE.DS 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.DE.SH AUTHORAlfredo Jahn V.DEMark L. Ulferts.LP.SH KEYWORDSmessagebox, scrolledtext, text, widget
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -