Skip to content

dialogs

Show native open, save and message dialogs and capture the result from them.

import { dialogs } from 'miletus';

dialogs.showErrorDialog('Missing file', 'This file is missing!');

Methods

showOpenDialog([options])

  • options DialogOptions (optional) - Options object
    • title string (optional) - Title of the dialog
    • defaultDir string (optional)
    • properties string[] (optional) - Supported values: allowMultiSelect, forceShowHidden, overwritePrompt, noChangeDir.
    • filter string (optional) - Filter the files. Example: Images|*.jpeg;*.png|Text files|*.txt|All files|*.*
    • filterIndex number (optional)
    • defaultExt string (optional)

Shows a native open dialog.
Returns Promise<DialogResult> - Resolves with the selected file or directory path. See DialogResult.

showSaveDialog([options])

  • options DialogOptions (optional) - Options object
    • title string (optional) - Title of the dialog
    • defaultDir string (optional)
    • properties string[] (optional) - Supported values: allowMultiSelect, forceShowHidden, overwritePrompt, noChangeDir.
    • filter string (optional) - Filter the files. Example: Images|*.jpeg;*.png|Text files|*.txt|All files|*.*
    • filterIndex number (optional)
    • defaultExt string (optional)

Shows a native save dialog.
Returns Promise<DialogResult> - Resolves with the selected file or directory path. See DialogResult.

showErrorDialog(title, message)

  • title string - Title of the error dialog.
  • message string - Message to be shown in the error dialog.

Shows an error dialog.

showMessageBox([options])

  • options MessageBoxOptions (optional)
    • caption string (optional) - Caption of the message box.
    • title string (optional) - Title of the message box.
    • text string (optional) - Text to be shown in the message box.
    • verifyChecked boolean (optional) - Check the verification checkbox by default.
    • verifyText string (optional) - If not empty, show a verification text.
    • type string (optional) - Type of the message box. Supported values are: none, info, error, question and warn.
    • buttons string[] (optional) - A list of buttons to be added to the message box.
    • commandLink boolean (optional) - Make buttons command links (Windows only).

Show a message box.
Returns Promise<MessageBoxResult> - Resolves with an object which contains the dialog result and the checkbox state. See MessageBoxResult.