Displays a standard dialog box that prompts the user to open a file. This class cannot be inherited.
- Namespace
- xtd::forms
- Library
- xtd.forms
- Examples
- The following code example demonstrate the use of open_file_dialog dialog.
#include <xtd/xtd>
using namespace std;
class form1 :
public form {
public:
form1() {
text("Open file dialog example");
controls().push_back(button1);
dialog.
initial_directory(!file_name.empty() ? io::path::get_directory_name(file_name) : environment::get_folder_path(environment::special_folder::desktop));
dialog.
file_name(io::path::get_file_name(file_name));
dialog.
filter(
"Text Files (*.txt)|*.txt|All Files (*.*)|*.*");
label1.text(ustring::format("File = {}", file_name));
}
};
label1.parent(*this);
label1.text("File = ");
label1.auto_size(true);
label1.location({10, 40});
}
private:
};
int main() {
}
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
- Examples
- image_list.cpp, and open_file_dialog.cpp.
|
| open_file_dialog ()=default |
| Initializes a new instance of the open_file_dialog class.
|
|
virtual bool | multiselect () const |
| Gets a value indicating whether the dialog box allows multiple files to be selected.
|
|
virtual open_file_dialog & | multiselect (bool value) |
| Sets a value indicating whether the dialog box allows multiple files to be selected.
|
|
std::ifstream | open_file () const |
| Opens the file with read only permission selected by the user.
|
|
| file_dialog ()=default |
| Initializes a new instance of the common_dialog class.
|
|
virtual bool | add_extension () const |
| Gets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension.
|
|
virtual file_dialog & | add_extension (bool value) |
| Sets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension.
|
|
virtual bool | auto_upgrade_enabled () const |
| Gets a value indicating whether this file_dialog instance should automatically upgrade appearance and behavior when running on Windows Vista.
|
|
virtual file_dialog & | auto_upgrade_enabled (bool value) |
| Sets a value indicating whether this file_dialog instance should automatically upgrade appearance and behavior when running on Windows Vista.
|
|
virtual bool | check_file_exists () const |
| Gets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist.
|
|
virtual file_dialog & | check_file_exists (bool value) |
| Sets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist.
|
|
virtual bool | check_path_exists () const |
| Gets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist.
|
|
virtual file_dialog & | check_path_exists (bool value) |
| Sets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist.
|
|
virtual const xtd::ustring & | default_ext () const |
| Gets the default file name extension.
|
|
virtual file_dialog & | default_ext (const xtd::ustring &value) |
| Sets the default file name extension.
|
|
virtual bool | dereference_link () const |
| Gets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk).
|
|
virtual file_dialog & | dereference_link (bool value) |
| Sets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk).
|
|
virtual const xtd::ustring & | file_name () const |
| Gets a string containing the file name selected in the file dialog box.
|
|
virtual file_dialog & | file_name (const xtd::ustring &value) |
| Sets a string containing the file name selected in the file dialog box.
|
|
virtual const std::vector< xtd::ustring > | file_names () const |
| Gets the file names of all selected files in the dialog box.
|
|
virtual const xtd::ustring & | filter () const |
| Gets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box.
|
|
virtual file_dialog & | filter (const xtd::ustring &value) |
| Sets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box.
|
|
virtual size_t | filter_index () const |
| Gets the index of the filter currently selected in the file dialog box.
|
|
virtual file_dialog & | filter_index (size_t value) |
| Sets the index of the filter currently selected in the file dialog box.
|
|
virtual const xtd::ustring & | initial_directory () const |
| Gets the initial directory displayed by the file dialog box.
|
|
virtual file_dialog & | initial_directory (const xtd::ustring &value) |
| Sets the initial directory displayed by the file dialog box.
|
|
size_t | options () const |
| Gets values to initialize the file_dialog.
|
|
void | reset () override |
| Resets all properties to their default values.
|
|
virtual bool | restore_directory () const |
| Gets a value indicating whether the dialog box restores the directory to the previously selected directory before closing.
|
|
virtual file_dialog & | restore_directory (bool value) |
| Sets a value indicating whether the dialog box restores the directory to the previously selected directory before closing.
|
|
virtual bool | show_help () const |
| Gets a value indicating whether the Help button is displayed in the file dialog box.
|
|
virtual file_dialog & | show_help (bool value) |
| Sets a value indicating whether the Help button is displayed in the file dialog box.
|
|
virtual bool | show_hidden_files () const |
| Gets a value indicating whether hidden files are displayed in the file dialog box.
|
|
virtual file_dialog & | show_hidden_files (bool value) |
| Sets a value indicating whether hidden files are displayed in the file dialog box.
|
|
virtual bool | show_preview () const |
| Gets a value indicating whether preview file is displayed in the file dialog box.
|
|
virtual file_dialog & | show_preview (bool value) |
| Sets a value indicating whether preview file is displayed in the file dialog box.
|
|
virtual bool | support_multi_dotted_extensions () const |
| Gets whether the dialog box supports displaying and saving files that have multiple file name extensions.Gets or sets whether the dialog box supports displaying and saving files that have multiple file name extensions.
|
|
virtual file_dialog & | support_multi_dotted_extensions (bool value) |
| Sets whether the dialog box supports displaying and saving files that have multiple file name extensions.Gets or sets whether the dialog box supports displaying and saving files that have multiple file name extensions.
|
|
virtual const xtd::ustring & | title () const |
| Gets the file dialog box title.
|
|
virtual file_dialog & | title (const xtd::ustring &value) |
| Sets the file dialog box title.
|
|
xtd::ustring | to_string () const noexcept override |
| Provides a string version of this object.
|
|
virtual bool | validate_names () const |
| Gets a value indicating whether the dialog box accepts only valid file names.
|
|
virtual file_dialog & | validate_names (bool value) |
| Gets a value indicating whether the dialog box accepts only valid file names.
|
|
| common_dialog ()=default |
| Initializes a new instance of the common_dialog class.
|
|
xtd::forms::dialog_result | dialog_result () const |
| Get async dialog_result result after dialog box is closing.
|
|
virtual void | reset ()=0 |
| When overridden in a derived class, resets the properties of a common dialog box to their default values.
|
|
xtd::forms::dialog_result | show_dialog () |
| Runs a common dialog box with a default owner.
|
|
xtd::forms::dialog_result | show_dialog (const iwin32_window &owner) |
| Runs a common dialog box with the specified owner.
|
|
void | show_sheet (const iwin32_window &owner) |
| Runs a common dialog box with the specified owner.
|
|
xtd::forms::dialog_result | show_sheet_dialog (const iwin32_window &owner) |
| Runs a common dialog box with the specified owner.
|
|
std::any | tag () const |
| Gets an object that contains data about the control.
|
|
common_dialog & | tag (const std::any &tag) |
| Sets an object that contains data about the control.
|
|
| object ()=default |
| Create a new instance of the ultimate base class object.
|
|
virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object.
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type.
|
|
template<typename object_t > |
std::unique_ptr< object_t > | memberwise_clone () const |
| Gets the type of the current instance.
|
|
virtual xtd::ustring | to_string () const noexcept |
| Returns a std::string that represents the current object.
|
|