Diagnostics -- Provide error warning and message dialogs


package require Diagnostics

::Diagnostics::Dialog title message icon exit-option

::Diagnostics::Error error-message

::Diagnostics::Info info-message

::Diagnostics::Warning warning-msg


This package provides some simple mechanisms for reporting errors, warnings and information to users. The main proc is ::Diagnostics::Dialog. It is written to operate in either Tk or Tcl only environments.

In Tcl mode the error message is output to stderr and, if the exit-option is true, theuser given a yes no prompt to exit the program. If the user chooses yes, the program exits otherwise the function returns.

In Tk mode, a tk_dialog is used to output the error message. The title parameter is used as the dialog title (displayed in the to level's title bar). The message text is displayed in the dialog body. icon identifies a bitmap that will be displayed to the left of the message. This is normally one of errro, info or warning, although any Tk bitmap object can be used.l

In Tk mode, regardless, the dialog contains a Continue button which returns control to the application. If exit-option is boolean true, an additional Exit button is displayed and the application exits if that was clicked.

The remainder of the procs defined by this package are simply convenience commands that build pre-defined dialog types:

::Diagnostics::Error message

This is equivalent to

::Diagnostics::Dialog Error $message error 1

::Diagnostics::Info message

Equivalent to

::Diagnostics::Dialog Information $message info 0

::Diagnostics::Warning message

Equivalent to:

::Diagnostics::Dialog Warning $message warning 1