Interface DialogTemplateFor<T>

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:

  1. The dialog user sets the value property to the value to be edited, or null to start from a default state.
  2. The dialog user sets the 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.
  3. The dialog user shows the dialog; the template's beforeShow sets up the controls to reflect the value property.
  4. When the user closes the dialog, the value property will be updated before the dialog user's onClose is invoked: If the end user accepts the dialog, the accept button's onUse handler updates the state of the value property to reflect the edited state. If the end user cancels the dialog, the cancel button's onUse handler sets the value property to undefined.

Type parameters

  • T

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.

Optional value

value: T

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.