ui::PickFileOptions¶
Header: winui/ui/Pickers.hpp.
What pick_file() and pick_files() are asked for. Every field is optional.
Example:
ui::Property<std::string> file_name;
if (auto path = ui::pick_file(window, {.title = "Pick an image",
.file_types = {{.name = "Images", .extensions = {".png", ".jpg"}}}}))
{
file_name = ui::path_to_utf8(path->filename());
}
| Field | Type | Default | |
|---|---|---|---|
title |
std::string |
The dialog caption; empty keeps the default. | |
commit_button_text |
std::string |
The Open button's label; empty keeps "Open". | |
file_types |
std::vector<FileType> |
Named types for the type box. They win over extensions. |
|
extensions |
std::vector<std::string> |
Plain extensions (".txt", or "*"), one type-box entry each, plus one for all of them and one for all files. 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. |
|
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. |