Expand description
Open, save and folder pickers (rfd).
Describe the dialog with FileDialog, then call a blocking picker (FileDialog::open_file,
…) or its async twin (FileDialog::open_file_async, …). A dismissed dialog is
NativeError::Cancelled.
Threads: on macOS the blocking pickers must run on the main thread (or on another thread while
the main thread is running its event loop); the async pickers run anywhere and are the right
choice inside an event loop. On the web only FileDialog::open_bytes_async exists (browsers
give the page a file’s contents, never its path); everything else is Unsupported.
Parent a dialog to a window with FileDialog::parent: it then opens over that window (a
sheet on macOS) and keeps it from taking input until it closes.
message shows a modal message box, for what must be said before (or without) a window:
a start-up failure, command-line output in an app that has no console.
Structs§
- File
Dialog - What a dialog shows. Every field is optional.
- Filter
- One filter row: a name and the extensions it accepts (without dots:
["png", "jpg"]). - Parented
- A
FileDialogshown over a window (FileDialog::parent). Its pickers block like the unparented ones, so call them between frames, not inside one.
Enums§
- Message
Level - How serious a
messageis; the OS picks the icon.
Functions§
- message
- Show a modal message box with one OK button and wait until it is dismissed. Main thread on
macOS.
Unsupportedon the web.