Interface DialogTemplate

A template that declaratively describes a dialog box, its contents, and its logic.

Hierarchy

Index

Properties

Optional acceptButton

acceptButton: ButtonTemplate

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.

Optional beforeClose

beforeClose: function

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.

Type declaration

Optional beforeShow

beforeShow: function

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.

Type declaration

Optional cancelButton

cancelButton: ButtonTemplate

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.

Optional controls

controls: WidgetTemplate[]

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.

Optional onClose

onClose: function

If defined, this function will be called after the dialog closes. Any return value is ignored.

Type declaration

Optional pageX

pageX: number

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.

Optional pageY

pageY: number

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.

Optional title

title: string

The dialog's title text.

Methods

Optional close

  • close(): void
  • 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().

    Returns void

Optional rebuild

  • rebuild(): void
  • 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.

    Returns void

Optional update

  • update(): void
  • 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.

    Returns void

This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.