iwidgets::messagebox(1)
π iwidgets::messagebox β the [incr Widgets] era, bestie edition
okay so you found the iwidgets::messagebox page, welcome, pull up a chair, we're doing this π
πΈ NAME πΈ
iwidgets::messagebox β bestie, it creates and manipulates a messagebox text widget. that's the whole vibe. a text widget that shows messages. iconic.
β¨ SYNOPSIS β¨
iwidgets::messagebox pathName ?options?
that's it. that's the summoning ritual π«Ά
𧬠INHERITANCE π§¬
the family tree goes like this, no cap:
itk::Widget <- iwidgets::Labeledwidget <- iwidgets::Scrolledwidget <-
iwidgets::Messagebox
so it inherited the whole bloodline: itk::Widget, then iwidgets::Labeledwidget, then iwidgets::Scrolledwidget, and finally iwidgets::Messagebox itself. main character energy from every ancestor π
β STANDARD OPTIONS β
these are the classics, the standard-issue glow-up options:
activeBackgroundactiveForegroundbackgroundborderWidthcursorexportSelectionfontforegroundhighlightColorhighlightThicknesspadXpadYreliefsetGrid
if you want the tea on what each one actually does, go read the "options" manual entry, bestie. it's all in there.
π ASSOCIATED OPTIONS π
these come from its friends. group project, but make it fashion:
from the labeledwidget class β go read the "labeledwidget" class manual entry for the details:
labelBitmaplabelFontlabelImagelabelMarginlabelPoslabelTextlabelVariable
from the scrollbar widget β details live in the "scrollbar" widget manual entry:
activeReliefelementBorderWidthjumptroughColor
from the scrolledtext widget β details are in the "scrolledtext" widget manual entry:
heighthscrollModesbWidthscrollMargintextBackgroundvisibleItemsvscrollModewidth
from the text widget β and the "text" widget manual entry has the receipts for these:
spacing1spacing2spacing3
π WIDGET-SPECIFIC OPTIONS π
these are the ones that are hers, okay? homegrown, one of a kind π
- Name:
fileName/ Class:FileName/ Command-Line Switch:-filenameβ specifies the filename to be displayed in the file selection dialog when it pops up during a save of the messagebox contents operation. so when you go to save, this is the name it's already got typed in there. thoughtful fr fr. - Name:
maxLines/ Class:MaxLines/ Command-Line Switch:-maxlinesβ 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 remainsmaxlines. it's giving "we're at capacity, grandma's leaving" π - Name:
saveDir/ Class:SaveDir/ Command-Line Switch:-savedirβ specifies the default directory to display when the file selection dialog pops up during a save of the messagebox contents operation. and if this parameter is not specified, then the files in the current working directory are displayed. default behavior, we love her.
π DESCRIPTION π
so the iwidgets::messagebox command creates a scrolled information messages area widget. a whole little zone for your messages, scrollable, chef's kiss.
message types can be user defined and configured β you're the designer, you're the creative director. their options include foreground, background, font, bell, and their display mode of on or off. which means message types can be defined as needed, removed when no longer so, and modified when necessary. flexible queen π¦ and there's an export method provided for file I/O, because of course.
the number of lines displayed may be limited, with the default being 1000. when this limit is reached, the oldest line is removed. (rip to that line, you served well π«‘)
there's a popup menu that appears when the right mouse button has been pressed in the message area, and it's already predefined for you. its contents 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. customize away, bestie.
π¬ 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 that control the display include the following:
-backgroundcolor β color specifies the background color to use for characters associated with the message type. it may have any of the forms accepted byTk_GetColor. paint it, girl π¨-bellboolean β specifies whether or not to ring the bell whenever a message of this type is issued. boolean may have any of the forms accepted byTk_GetBoolean. the default is0. (so no, it does not go ding by default, you have to ask for the ding π)-fontfontName β fontName is the name of a font to use for drawing characters. it may have any of the forms accepted byTk_GetFontStruct. pick your typography, it matters β¨-foregroundcolor β color specifies the foreground color to use for characters associated with the message type. it may have any of the forms accepted byTk_GetColor. the text itself. the lewk.-showboolean β specifies whether or not to display this message type when issued. boolean may have any of the forms accepted byTk_GetBoolean. the default is1. (so yes, by default it SHOWS. she's not shy π )
π οΈ METHODS π οΈ
the iwidgets::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. and the following commands are possible for messagebox widgets:
π«Ά WIDGET-SPECIFIC METHODS π«Ά
pathName cgetoption β returns the current value of the configuration option given by option. option may have any of the values accepted by theiwidgets::messageboxcommand.pathName clearβ clear the messagebox of all messages. boom, empty, fresh start, clean slate π§ΌpathName exportfilename β write text to a file. if filename exists then contents are replaced with text widget contents. > β οΈ heads up: it replaces what's already in that file. no undo, bestie. be sure.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 forpathName(seeTk_ConfigureInfofor 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 theiwidgets::messageboxcommand.pathName typeoption msgtype ?arg arg ...? β this command is used to manipulate message types. the behavior of the command depends on the option argument that follows thetypekeyword. the following forms of the command are supported:pathName type addmsgtype ?option value ...? β adds a new message type given by msgtype with the display properties defined by the option value pairs. see MESSAGE TYPES for information on the options that are supported. new type just dropped π₯pathName type cgetmsgtype option β returns the value of a configuration option for a message type. msgtype identifies the message type, and option specifies a particular configuration option, which must be one of the ones listed in the section MESSAGE TYPES.pathName type configuremsgtype ?option value ...? β query or modify the configuration options for a message type. if no option is specified, returns a list describing all of the available options for the message type msgtype. if option is specified with no value, then the command returns a list describing the one named option. if one or more option-value 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.pathName type removemsgtype β removes an existing message type given by msgtype. gone, deleted, blocked, unfollowed π
pathName issuestring ?level? ?tags? β print a string to the text area at the given level and with any additional tags specified. this is the one you'll be calling the most, fr fr.
π§© COMPONENTS π§©
- Name:
itemMenu/ Class:Menuβ 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. right-click rights π - Name:
text/ Class:Scrolledtextβ the text component is thescrolledtextwidget. see the "scrolledtext" widget manual entry for details on the text component item.
π EXAMPLE π
steal this, it's cute:
package require Iwidgets 4.0
iwidgets::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
see? three whole message types, each with its own outfit, and then you just issue them into existence. slay π
π©π» AUTHOR π©π»
Alfredo Jahn V and Mark L. Ulferts β the icons who wrote this. thank you for your service π«Ά
π KEYWORDS π
messagebox, scrolledtext, text, widget
and that's the page, bestie! this came out of the Tk source, and it's the iwidgets::messagebox(1) manual entry β so go forth, make your messages pretty, and remember: if you're saving over a file, that's on you π bye!! πΈβ¨
π¦ where this page comes from
- debian bookworm: iwidgets4-doc 4.1.1-2.1
- debian trixie: iwidgets4-doc 4.1.1-4
- ubuntu jammy: iwidgets4-doc 4.1.1-2.1
- ubuntu noble: iwidgets4-doc 4.1.1-2.1
- ubuntu resolute: iwidgets4-doc 4.1.1-4
- ubuntu stonking: iwidgets4-doc 4.1.1-4
- Copyright (c) 1995 DSC Technologies Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms