Class: Document

ui.Document

new ui.Document ()

Element representing the document. This is an extension of the Document class and adds theming as well as some modal standard dialogs.

The document is accessible anywhere from within its subtree by the thisDocument property.

The current theme is accessed by the theme property. The theme may be changed at run-time.

The shortcut receiver is a component for receiving keyboard shortcuts. By default, the document is the shortcut receiver. Sub-elements, however, may redefine the shortcutReceiver property for handling keyboard shortcuts. This way, different scopes of keyboard shortcuts can be implemented and even nested.

Keyboard shortcuts may be defined by any component by connecting to the keyDown event of the effective shortcut receiver, accessed by the shortcutReceiver reference.

Box {
    shortcutReceiver.onKeyDown: ev =>
    {
        // handle the shortcuts...
    }
}
Properties:
Name Type Description
documentRoot ui.Document

[readonly] Deprecated: Use thisDocument instead. A reference to this document. Elements within the document may use this reference.

shortcutReceiver ui.Document

[readonly] A reference to this document for functioning as a receiver of keyboard shortcuts.

theme ui.Theme

(default: Theme { }) The current UI theme.

Extends

Methods

showErrorDialog (title, message, callback)ui.Dialog

Shows a modal error message dialog.

Name Type Description
title string

The title of the dialog.

message string

The message text of the dialog.

callback function

The callback that is invoked when the user closes the dialog.

Returns:
Type Description
ui.Dialog The dialog instance.

showInfoDialog (title, message, callback)ui.Dialog

Shows a modal info message dialog.

Name Type Description
title string

The title of the dialog.

message string

The message text of the dialog.

callback function

The callback that is invoked when the user closes the dialog.

Returns:
Type Description
ui.Dialog The dialog instance.

showMessageDialog (title, icon, message, buttons)ui.Dialog

Shows a generic modal message dialog.

Name Type Description
title string

The title of the dialog.

icon string

The name of the icon on the dialog.

message string

The message text of the dialog.

buttons Array.<object>

The dialog buttons. Each item in the list is a { label, callback } object.

Returns:
Type Description
ui.Dialog The dialog instance.
Example
showMessageDialog("Error opening file", "core-bug", "The file could not be opened.", [
    { label: "Retry", callback: retryCallback },
    { label: "Cancel", callback: cancelCallback }
]);

showProgressDialog (title, message)ui.Dialog

Shows a modal progress dialog.

The returned dialog instance has a property progress for changing the progress value (a value between 0.0 and 1.0), and a property message for changing the current message text.

Name Type Description
title string

The title of the dialog.

message string

The message text of the dialog.

Returns:
Type Description
ui.Dialog The dialog instance.

showQuestionDialog (title, message, yesCallback, noCallback)ui.Dialog

Shows a modal question dialog with buttons for answering "Yes" or "No".

Name Type Description
title string

The title of the dialog.

message string

The message text of the dialog.

yesCallback function

The callback that is invoked when the user chooses "Yes".

noCallback function

The callback that is invoked when the user chooses "No".

Returns:
Type Description
ui.Dialog The dialog instance.

showWarningDialog (title, message, callback)ui.Dialog

Shows a modal warning message dialog.

Name Type Description
title string

The title of the dialog.

message string

The message text of the dialog.

callback function

The callback that is invoked when the user closes the dialog.

Returns:
Type Description
ui.Dialog The dialog instance.