An "OK" button that the user can press to close the dialog and complete any associated action. If this defines an onUse function, that function will be called when the button is clicked. If it does not return true, the dialog will be prevented from closing.
If defined, this function will be called before the dialog is closed, no matter what action caused the close process to begin. If it does not return true, the dialog will not close.
If defined, this function will be called after the dialog is fully constructed but before it is shown. If it does not return true, the dialog will not be shown.
A "Cancel" button that the user can press to close the dialog without completing any associated action. If this button is specified, it will also be "clicked" if the user tries to close the dialog by pressing Escape or clicking outside of the dialog. If this button is not specified, the dialog will simply close in these cases. If the button defines an onUse function, that function will be called when the button is clicked. If it does not return true, the dialog will be prevented from closing.
An array of form controls that will be added to the dialog in the order listed. Any controls that define an id
property can be looked up from this array by their id in addition to their array index.
If defined, this function will be called after the dialog closes. Any return value is ignored.
The optional x-offset at which to display the centre of the dialog, relative to the left edge of the document. The actual location of the dialog may be adjusted to ensure visibility. When defined, pageY must also be set. When no explicit position is given for the dialog, it will be centered at the top of the window.
The optional y-offset at which to display the top of the dialog, relative to the top edge of the document. The actual location of the dialog may be adjusted to ensure visibility. When defined, pageX must also be set.
The dialog's title text.
If called while the dialog is showing, this will close the dialog. This function is added automatically by the toolkit when the dialog is shown. Calling this will not trigger either the accept or cancel buttons. To simulate the user choosing the accept (OK) button, use template.acceptButton.element.click()
. Similarly, to simulate the cancel button, use template.cancelButton.element.click()
.
If called while the dialog is showing, this will update the rebuild the dialog as if a widget handler function (such as onUse
) returned true. This function is added automatically by the toolkit when the dialog is shown.
If called while the dialog is showing, this will update the widget states as if a widget handler function (such as onUse
) returned false. This function is added automatically by the toolkit when the dialog is shown.
This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.
An extension to the standard dialog template for dialogs that are intended to edit a specific kind of value. They are used in a standard pattern, as follows:
value
property to the value to be edited, ornull
to start from a default state.onClose
property to a handler that will be called when the end user closes the dialog. This handler will be responsible for dealing with the edited value.beforeShow
sets up the controls to reflect thevalue
property.value
property will be updated before the dialog user'sonClose
is invoked: If the end user accepts the dialog, the accept button'sonUse
handler updates the state of thevalue
property to reflect the edited state. If the end user cancels the dialog, the cancel button'sonUse
handler sets thevalue
property toundefined
.