@Js
@Serializable {
simple=false
collection=false
}
Dialog is a transient window, typically used to notify or input information from the user. Dialog also contains convenience routines for opening message boxes.
Slots
- bodySource
-
Obj? body
Main body of the content:
- Str: displays string as label
- Widget: used as main content See buildContent.
- buildContentSource
-
virtual This buildContent()
Build the dialog content using the image, body, details, and commands fields. Return this. This method is automatically called by open if the content field is null.
- cancelSource
-
static Command cancel()
Predefined dialog command for Cancel.
- commandsSource
-
Command[]? commands := Command[Dialog.ok()]
The commands are mapped to buttons along the bottom of the dialog. If a predefined command such as ok is passed, then it closes the dialog and is returned as the result. If a custom command is passed, then it should close the dialog as appropiate with the result object.
- detailsSource
-
Obj? details
The details parameter is hidden by default, but may be displayed by the user via the "Details" button. The details button is implicitly added to the command set if details is non-null. Details may be any of the following
- Str: displays string as label
- Err: displays error trace as string
- Widget: mounted as main content of details box See buildContent.
-
private native Void dummyDialog()
- imageSource
-
Image? image
Image to the left of the body when building content. See buildContent.
- makeSource
-
new make(Window? parent)
Construct dialog.
- noSource
-
static Command no()
Predefined dialog command for No.
- okSource
-
static Command ok()
Predefined dialog command for OK.
- okCancelSource
-
static Command[] okCancel()
Convenience for
[ok, cancel]
. - openSource
-
override Obj? open()
Overrides fwt::Window.open
If the content field is null, then construct is via buildContent.
- openErrSource
-
static Obj? openErr(Window? parent, Str msg, Obj? details := null, Command[] commands := [Dialog.ok()])
Open an error message box. See openMsgBox.
- openInfoSource
-
static Obj? openInfo(Window? parent, Str msg, Obj? details := null, Command[] commands := [Dialog.ok()])
Open an information message box. See openMsgBox.
- openMsgBoxSource
-
static Obj? openMsgBox(Pod pod, Str keyBase, Window? parent, Obj body, Obj? details := null, Command[] commands := [Dialog.ok()])
Open a message box. The pod's locale properties map as follows:
- "{keyBase}.name": title of the message box
- "{keyBase}.icon": icon for the message box
See buildContent for a description of the body, details, and commands. You may pass commands as the details parameter if details are null.
The command invoked to close message box is returned. If the dialog is canceled using the window manager then null is returned.
- openPromptStrSource
-
static Str? openPromptStr(Window? parent, Str msg, Str def := "", Int prefCols := 20)
Open a prompt for the user to enter a string with an ok and cancel button. Return the string value or null if the dialog is canceled. The text field is populated with the
def
string which defaults to "". - openQuestionSource
-
static Obj? openQuestion(Window? parent, Str msg, Obj? details := null, Command[] commands := [Dialog.ok()])
Open a question message box. See openMsgBox.
- openWarnSource
-
static Obj? openWarn(Window? parent, Str msg, Obj? details := null, Command[] commands := [Dialog.ok()])
Open a warning message box. See openMsgBox.
- yesSource
-
static Command yes()
Predefined dialog command for Yes.
- yesNoSource
-
static Command[] yesNo()
Convenience for
[yes, no]
.