Version 11 of messageBox

Updated 2002-03-01 20:58:28

http://purl.org/tcl/home/man/tcl8.4/TkCmd/messageBox.htm

Note: Unlike most Tk widgets, this widget's name (messageBox) is not the same as its creation command (tk_messageBox).


incr Widgets also has a messageBox - once their DNS problems are resolved, a URL to their doc will be inserted in place of this part of the msg.


With recent versions, the Windows messageBox is "native", while the Unix one continues to rely on the implementation visible in ./library/msgbox.tcl. Before version 8.something, both Win* and Unix used msgbox.tcl (what about Mac?). Notice that this means that, if there's something about messageBox you don't like, you have the source code readily available for your enhancements.

[Detail example of how to do this.]


[Give example of how to use option database with messageBox.]

On Unix, the default font for message boxes is Times 18, which is way too fat for longer text. Before creating a messageBox, just add the line

 option add *Dialog.msg.font {Times 12} 

to get a better readable font (won't hurt in Windows, where native message boxes are used anyway). (RS)

the wraplength also defaults to 3 inches but can be overriden the same way for long messages (BBH)

 option add *DIalog.msg.wrapLength 6i  

Martin Lemburg Because of the need to have a messagebox in the tclsh, I wrote a tclsh version ... tcl_messageBox. To download the stubs enabled version (tcl v8.1 and higher) use the URL:

    ftp://ftp.dcade.de/pub/ml/tcl/packages/tcl_messageBox10.zip
    (package only)
    ftp://ftp.dcade.de/pub/ml/tcl/packages/tcl_messageBox10.all.zip
    (inclusive the source, project files, etc.)

The syntax is simular to the tk_messageBox:

   tcl_messageBox ?option optionArg option optionArg ...?

options:

  • -align: left or right
  • -default: depends on the given type
  • -icon: exclamation, warning, info(rmation), asterisk, question, stop, error or hand
  • -message: string, may be empty
  • -modal: app(lication), window, system or task
  • -title: string, may be empty
  • -type: abortretryignore, ok, okcancel, retrycancel, yesno or yesnocancel
  • -help: this text

Tk syntax help - Arts and crafts of Tcl-Tk programming - Category Command