delphidelphi-2009folderbrowserdialogtopendialog

What is the most common way to create a folder selection dialog using Delphi?


There doesn't appear to be a simple component available to create a folder selection dialog in Delphi 2009, although a file selection dialog is provided by way of the TOpenDialog.

What is the most common way to create a modern folder selection dialog using Delphi?


Solution

  • There are two overloaded routines in FileCtrl.pas called SelectDirectory

    For a modern look, use the second form, with sdNewUI

    var
      dir : string;
    begin
      dir := 'C:\temp';
      FileCtrl.SelectDirectory('Select', 'C:\', dir, [sdNewFolder, sdNewUI], Self);
    end;
    

    NOTE: sdNewFolder, sdNewUI etc are only available from D2006+