|
Messagebox
The messagebox iwidget is used to display messages in a scrolled text window. The messages can be differianted by specifying different attributes for each kind of message. For example, one type of message might have a green background, while another message might have a red background. Each message will take up one line in the text window, so the attributes affect the whole line. There are public methods that allow the programmer to issue messages, and to clear the message area. There are also public methods for file I/O, that allow the programmer to save the messagebox contents, exportthe messagebox contents and to find keywords within the messagebox. There is also a pop-up menu where the user can choose: Clear, Save or Find. This is just a short cut for the most common uses of the messagebox. Chosing Clear will delete the contents of the messagebox. Choosing Save will invoke tk_getSaveFile and use the -filename and -savedir as the initial inputs. Choosing Find will invoke a find dialog.
For further information, see the Messagebox
manpage
Components: hull itemMenu text
|
wm title . "Messagebox Example"
##=========================================================
## Create a Messagebox iwidget
##=========================================================
##
iwidgets::messagebox .mb \
-maxlines 100
pack .mb \
-fill both \
-expand true
##
## Create some message types
##
foreach {t c} {info green warning yellow critical red} {
.mb type add $t \
-background $c \
-font {Helvetica 16}
}
##
## Create some messages that get
## written to the messagebox
##
.mb issue "This is just an info message" info
.mb issue "This is just a warning message" warning
.mb issue "This is just a critical message" critical
.mb issue "This is just another info message" info
.mb issue "Oh no, the temperature is getting a little warm" warning
.mb issue "Oh no, the temperature is getting too hot" critical
|
Download this sample code |
|