@lynx-js/lynxtron / Dialog
Dialog
Methods
showErrorBox()
Displays a modal dialog that shows an error message.
This API can be called safely before the ready event the app module emits,
it is usually used to report errors in early stage of startup. If called before
the app readyevent on Linux, the message will be emitted to stderr, and no GUI
dialog will appear.
Parameters
Returns
void
Defined in
showMessageBox()
window: BaseWindow
resolves with a promise containing the following properties:
responsenumber - The index of the clicked button.checkboxCheckedboolean - The checked state of the checkbox ifcheckboxLabelwas set. Otherwisefalse.
Shows a message box.
The window argument allows the dialog to attach itself to a parent window,
making it modal.
Parameters
Returns
Promise<MessageBoxReturnValue>
Defined in
options: MessageBoxOptions
resolves with a promise containing the following properties:
responsenumber - The index of the clicked button.checkboxCheckedboolean - The checked state of the checkbox ifcheckboxLabelwas set. Otherwisefalse.
Shows a message box.
The window argument allows the dialog to attach itself to a parent window,
making it modal.
Parameters
Returns
Promise<MessageBoxReturnValue>
Defined in
showMessageBoxSync()
window: BaseWindow
the index of the clicked button.
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button.
The window argument allows the dialog to attach itself to a parent window,
making it modal. If window is not shown dialog will not be attached to it. In
such case it will be displayed as an independent window.
Parameters
Returns
number
Defined in
options: MessageBoxSyncOptions
the index of the clicked button.
Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button.
The window argument allows the dialog to attach itself to a parent window,
making it modal. If window is not shown dialog will not be attached to it. In
such case it will be displayed as an independent window.
Parameters
Returns
number
Defined in
showOpenDialog()
window: BaseWindow
Resolve with an object containing the following:
canceledboolean - whether or not the dialog was canceled.filePathsstring[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.bookmarksstring[] (optional) macOS mas - An array matching thefilePathsarray of base64 encoded strings which contains security scoped bookmark data.securityScopedBookmarksmust be enabled for this to be populated. (For return values, see table here.)
The window argument allows the dialog to attach itself to a parent window,
making it modal.
The filters specifies an array of file types that can be displayed or selected
when you want to limit the user to a specific type. For example:
The extensions array should contain extensions without wildcards or dots (e.g.
'png' is good but '.png' and '*.png' are bad). To show all files, use the
'*' wildcard (no other wildcard is supported).
On Windows and Linux an open dialog can not be both a file selector
and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.
On Linux defaultPath is not supported when using portal file chooser
dialogs unless the portal backend is version 4 or higher. You can use
--xdg-portal-required-version command-line switch to force gtk or kde dialogs.
Parameters
Returns
Promise<OpenDialogReturnValue>
Defined in
options: OpenDialogOptions
Resolve with an object containing the following:
canceledboolean - whether or not the dialog was canceled.filePathsstring[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.bookmarksstring[] (optional) macOS mas - An array matching thefilePathsarray of base64 encoded strings which contains security scoped bookmark data.securityScopedBookmarksmust be enabled for this to be populated. (For return values, see table here.)
The window argument allows the dialog to attach itself to a parent window,
making it modal.
The filters specifies an array of file types that can be displayed or selected
when you want to limit the user to a specific type. For example:
The extensions array should contain extensions without wildcards or dots (e.g.
'png' is good but '.png' and '*.png' are bad). To show all files, use the
'*' wildcard (no other wildcard is supported).
On Windows and Linux an open dialog can not be both a file selector
and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.
On Linux defaultPath is not supported when using portal file chooser
dialogs unless the portal backend is version 4 or higher. You can use
--xdg-portal-required-version command-line switch to force gtk or kde dialogs.
Parameters
Returns
Promise<OpenDialogReturnValue>
Defined in
showOpenDialogSync()
window: BaseWindow
the file paths chosen by the user; if the dialog is cancelled it returns
undefined.
The window argument allows the dialog to attach itself to a parent window,
making it modal.
The filters specifies an array of file types that can be displayed or selected
when you want to limit the user to a specific type. For example:
The extensions array should contain extensions without wildcards or dots (e.g.
'png' is good but '.png' and '*.png' are bad). To show all files, use the
'*' wildcard (no other wildcard is supported).
On Windows and Linux an open dialog can not be both a file selector
and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.
On Linux defaultPath is not supported when using portal file chooser
dialogs unless the portal backend is version 4 or higher. You can use
--xdg-portal-required-version command-line switch to force gtk or kde dialogs.
Parameters
Returns
undefined | string[]
Defined in
options: OpenDialogSyncOptions
the file paths chosen by the user; if the dialog is cancelled it returns
undefined.
The window argument allows the dialog to attach itself to a parent window,
making it modal.
The filters specifies an array of file types that can be displayed or selected
when you want to limit the user to a specific type. For example:
The extensions array should contain extensions without wildcards or dots (e.g.
'png' is good but '.png' and '*.png' are bad). To show all files, use the
'*' wildcard (no other wildcard is supported).
On Windows and Linux an open dialog can not be both a file selector
and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.
On Linux defaultPath is not supported when using portal file chooser
dialogs unless the portal backend is version 4 or higher. You can use
--xdg-portal-required-version command-line switch to force gtk or kde dialogs.
Parameters
Returns
undefined | string[]
Defined in
showSaveDialog()
window: BaseWindow
Resolve with an object containing the following:
canceledboolean - whether or not the dialog was canceled.filePathstring - If the dialog is canceled, this will be an empty string.bookmarkstring (optional) macOS mas - Base64 encoded string which contains the security scoped bookmark data for the saved file.securityScopedBookmarksmust be enabled for this to be present. (For return values, see table here.)
The window argument allows the dialog to attach itself to a parent window,
making it modal.
The filters specifies an array of file types that can be displayed, see
dialog.showOpenDialog for an example.
On macOS, using the asynchronous version is recommended to avoid issues when expanding and collapsing the dialog.
Parameters
Returns
Promise<SaveDialogReturnValue>
Defined in
options: SaveDialogOptions
Resolve with an object containing the following:
canceledboolean - whether or not the dialog was canceled.filePathstring - If the dialog is canceled, this will be an empty string.bookmarkstring (optional) macOS mas - Base64 encoded string which contains the security scoped bookmark data for the saved file.securityScopedBookmarksmust be enabled for this to be present. (For return values, see table here.)
The window argument allows the dialog to attach itself to a parent window,
making it modal.
The filters specifies an array of file types that can be displayed, see
dialog.showOpenDialog for an example.
On macOS, using the asynchronous version is recommended to avoid issues when expanding and collapsing the dialog.
Parameters
Returns
Promise<SaveDialogReturnValue>
Defined in
showSaveDialogSync()
window: BaseWindow
the path of the file chosen by the user; if the dialog is cancelled it returns an empty string.
The window argument allows the dialog to attach itself to a parent window,
making it modal.
The filters specifies an array of file types that can be displayed, see
dialog.showOpenDialog for an example.
Parameters
Returns
string
Defined in
options: SaveDialogSyncOptions
the path of the file chosen by the user; if the dialog is cancelled it returns an empty string.
The window argument allows the dialog to attach itself to a parent window,
making it modal.
The filters specifies an array of file types that can be displayed, see
dialog.showOpenDialog for an example.
Parameters
Returns
string
Defined in