Skip to content

OpenFolderDialog.ShowDialog

method · OpenFolderDialog · cAlgo.API Since 5.1

DesktopCLICloud

Shows a file dialog, with the owner as the main Window

Environment behaviour

CLI — not supported. No dialog is shown. Returns FileDialogResult.None; FolderName is unchanged.

Cloud — not supported. No dialog is shown. Returns FileDialogResult.None; FolderName is unchanged.

Overloads

Signature Description
ShowDialog() Shows a file dialog, with the owner as the main Window
ShowDialog(Window owner) Shows a file dialog, with the passed owner window.

ShowDialog()

Shows a file dialog, with the owner as the main Window

public FileDialogResult ShowDialog()
openFolderDialog.ShowDialog() -> FileDialogResult

Returns FileDialogResult

Examples

var openFolderDialog = new OpenFolderDialog { Title = "Select folder" };
var result = openFolderDialog.ShowDialog();
Print("Dialog result: {0}, folder: {1}", result, openFolderDialog.FolderName);
openFolderDialog = OpenFolderDialog()
openFolderDialog.Title = "Select folder"
result = openFolderDialog.ShowDialog()
api.Print(f"Dialog result: {result}, folder: {openFolderDialog.FolderName}")

ShowDialog(Window owner)

Shows a file dialog, with the passed owner window.

public FileDialogResult ShowDialog(Window owner)
openFolderDialog.ShowDialog(owner: Window) -> FileDialogResult

Parameters

Name C# type Python type Description
owner Window Window The window that owns the file dialog.

Returns FileDialogResult

Examples

var window = new Window { Title = "Settings", Width = 300, Height = 200 };
var browseButton = new Button { Text = "Browse" };
browseButton.Click += args =>
{
    var openFolderDialog = new OpenFolderDialog();
    if (openFolderDialog.ShowDialog(window) == FileDialogResult.OK)
        Print("Folder: {0}", openFolderDialog.FolderName);
};
window.Child = browseButton;
window.Show();
window = Window()
window.Title = "Settings"
window.Width = 300
window.Height = 200
window.Show()
openFolderDialog = OpenFolderDialog()
if openFolderDialog.ShowDialog(window) == FileDialogResult.OK:
    api.Print(f"Folder: {openFolderDialog.FolderName}")