Confirm Dialog - Maple Help

Maplets[Elements]

 ConfirmDialog
 define a confirmation dialog

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

Parameters

 opts - equation(s) of the form option=value where option is one of caption, height, onapprove, oncancel, ondecline, reference, resizable, title, type, or width; specify options for the ConfirmDialog element refID - name or string; reference to the element

Description

 • The ConfirmDialog dialog element defines a confirmation dialog in a Maplet application. This dialog contains a caption and three buttons, Yes, No, and Cancel.

 • Maplets dialog elements have a predefined layout.  For a dialog, an author cannot specify elements.  This is different from the Window element, which can contain other elements, for example, buttons and layout elements.
 • The ConfirmDialog element features can be modified by using options. To simplify specifying options in the Maplets package, certain options and contents can be set without using an equation. The following table lists elements, symbols, and types (in the left column) and the corresponding option or content (in the right column) to which inputs of this type are, by default, assigned.

 Elements, Symbols, or Types Assumed Option or Content error, plain, question, or warning type option refID reference option string or symbol caption option

 • A ConfirmDialog element can contain Action or command elements to specify the onapprove, oncancel, and ondecline options.
 • A ConfirmDialog element can be contained in a Maplet element.
 • The following table describes the control and use of the ConfirmDialog element options.
 An x in the I column indicates that the option can be initialized, that is, specified in the calling sequence (element definition).
 An x in the R column indicates that the option is required in the calling sequence.
 An x in the G column indicates that the option can be read, that is, retrieved by using the Get tool.
 An x in the S column indicates that the option can be written, that is, set by using the SetOption element or the Set tool.

 Option I R G S caption x x height x x x onapprove x oncancel x ondecline x reference x resizable x x x title x x x type x width x x x

 • The opts argument can contain one or more of the following equations that set Maplet application options.
 caption = string or symbol
 The text that appears in the body of the confirmation dialog.
 height = posint
 The window height in pixels.
 onapprove = Action or command element, or reference to an Action element (name or string)
 The action that occurs when the user clicks the Yes button. By default, the action shuts down the dialog.
 oncancel = Action or command element, or reference to an Action element (name or string)
 The action that occurs when the user clicks either the Cancel button or the dialog close button on the title bar. By default, the action shuts down the dialog.
 ondecline = Action or command element, or reference to an Action element (name or string)
 The action that occurs when the user clicks the No button. By default, the action shuts down the dialog.
 reference = name or string
 A reference for the ConfirmDialog element.
 If the reference is specified by both an index, for example, ConfirmDialog[refID], and a reference in the calling sequence, the index reference takes precedence.
 resizable = true or false
 Whether the user can resize the window.  By default, false.
 title = string or symbol
 The text that appears in the title bar of the confirmation dialog. The default title is Confirmation.
 type = error, plain, question, or warning
 Displays an icon associated with the caption.  By default, a plain confirmation dialog, which does not display an icon, is used.
 width = posint
 The window width in pixels.

Examples

A Maplet application that has one confirmation dialog, which returns "true", "false", or "FAIL":

 > $\mathrm{with}\left(\mathrm{Maplets}\left[\mathrm{Elements}\right]\right):$
 > $\mathrm{maplet}≔\mathrm{Maplet}\left(\mathrm{ConfirmDialog}\left('\mathrm{question}',"Is x > 0?",'\mathrm{onapprove}'=\mathrm{Shutdown}\left("true"\right),'\mathrm{ondecline}'=\mathrm{Shutdown}\left("false"\right),'\mathrm{oncancel}'=\mathrm{Shutdown}\left("FAIL"\right)\right)\right):$
 > $\mathrm{Maplets}\left[\mathrm{Display}\right]\left(\mathrm{maplet}\right)$