Skip to content

ui::PickSaveFileOptions

Header: winui/ui/Pickers.hpp.

What pick_save_file() is asked for. Every field is optional.

Example:

auto path = ui::pick_save_file(window, {.file_types     = {{.name = "Text", .extensions = {".txt"}}},
                                        .suggested_name = "Notes"});

Field Type Default
title std::string The dialog caption; empty keeps the default.
commit_button_text std::string The Save button's label; empty keeps "Save".
file_types std::vector<FileType> Named types for the type box. They win over extensions; "All Files" when both are empty.
extensions std::vector<std::string> Plain extensions (".txt"), one type-box entry each, plus one for all of them. Used when file_types is empty.
initial_file_type std::optional<std::size_t> Which type-box entry starts selected, zero-based. Unset (the default) selects the first named type, or with extensions the entry for all of them.
default_extension std::string Appended when the user types a name without one (".txt"); empty: the selected type's first.
suggested_name std::string The name the dialog opens with.
start_location PickerLocation PickerLocation::Unspecified The known folder to open in when folder is empty.
folder std::filesystem::path The folder to open in, if it exists; absolute. Wins over start_location.
remember_last bool true True: folder (or start_location) opens the first time, and after that the dialog reopens wherever the user last picked from. False: it opens every time.
overwrite_prompt bool true Ask before replacing an existing file.