Error Dialog - Maple Help

Maplets[Utilities]

 ErrorDialog
 flexible error message display utility

 Calling Sequence ErrorDialog(opts) ErrorDialog[refID](opts)

Parameters

 opts - equation(s) of the form option=value; where option is one of caption, errormessage, reference, title, textboxmin, background, charperheight, maxheight, minheight, or width; specify options for the Maplet application refID - name or string; reference to the element

Description

 • The ErrorDialog(opts) calling sequence displays a message dialog that is formatted for displaying large error messages. There is no return value, simply a button to dismiss the error dialog.
 • The error dialog is displayed in one of two forms. For small error messages a Maplet MessageDialog is used to display the error. For larger messages a read-only TextBox is used to display the error. The error dialog automatically chooses which form to use based on the length of the error message, but the criteria and formatting are adjustable through options.

Options

 • The opts argument can contain one or more of the following equations that set Maplet application options. These are not in alphabetical order, as the latter options are specific to the TextBox form of the dialog.
 caption = string or symbol
 The text that appears preceding the error message. Intended to describe when/how the error occurred. This is optional.
 errormessage = string
 The formatted error message to be displayed. This field is required, but the errormessage = part can be omitted leaving only the string argument.  Note: StringTools:-FormatMessage must be used to convert a message with parameters into a text representation.
 reference = name or string
 A reference for the ErrorDialog element.
 If the reference is specified by both an index, for example, ErrorDialog[refID], and in the calling sequence, an error results.
 title = string or symbol
 The title that appears in the error dialog title bar. The default title is Error.
 textboxmin = nonnegint
 The minimum number of characters in the error message that will cause the error dialog to switch from a message dialog style to displaying the error in a separate text box. The default is 60.
 • The remaining options are only concerned with the text box error dialog style.
 background = color
 The color of the highlights of the text box in which the error is displayed. This can be a recognized color name, an RGB color structure, or a string of the form "#RRGGBB" where each pair is a two-digit hexadecimal number.
 charperheight = posint
 The number of characters that corresponds to a line in the text error message. Ignoring the minheight and maxheight settings below, this is used to compute the number of lines high the text box will be, based on the length of the error message. The default is 60, meaning an error with less than 60 characters represents a single line, less than 120 represents 2, and so on.
 maxheight = posint
 The maximum number of vertical text lines in the text box. The default is 5.
 minheight = posint
 The minimum number of vertical text lines in the text box. The default is 3.
 width = posint
 The width of the text box (in characters) in which the error is displayed. The default is 60.

Examples

An error dialog with the default settings displays as a message dialog when the error is less than 60 characters long.

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Utilities}\right]\right):$
 > $\mathrm{ErrorDialog}\left('\mathrm{title}'="Error Example",'\mathrm{caption}'="Sample error:",'\mathrm{errormessage}'="Short test error message"\right)$

Another example with a larger error message uses the text box form.

 > $\mathrm{ErrorDialog}\left('\mathrm{title}'="Error Example",'\mathrm{caption}'="Sample error:",'\mathrm{errormessage}'="Longer test error message to force the text box form for the Error Dialog. Just a few more characters..."\right)$