Documentation
On this page

Function · Desktop Services

showMessageDialog

Displays a native message dialog.

@sharpts/gui · SharpTS 572a2e31be0e

Signature

TypeScript
showMessageDialog(options: MessageDialogOptions): Promise<MessageDialogResult>

Parameters

NameTypeDescription
optionsMessageDialogOptionsTitle, message, and button-set options.

Returns

Promise<MessageDialogResult> — The button selected by the user.

Remarks

The dialog is owned by the active desktop window and blocks interaction with that window until dismissed. Labels and presentation are supplied by the operating system.

Throws

  • When no desktop window is available or the native dialog cannot be shown.

Examples

TypeScript
import { showMessageDialog } from "@sharpts/gui";

const result = await showMessageDialog({
    title: "Discard changes?",
    message: "Your unsaved changes will be lost.",
    buttons: "yesNo"
});
if (result === "yes") console.log("Confirmed");

Source

src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1474 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.