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

There is no simple component for creating a folder selection dialog box in Delphi 2009, although a file selection dialog is provided using TOpenDialog.

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

+7
delphi delphi-2009 folderbrowserdialog topendialog
source share
4 answers

There are two overloaded procedures 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. only available with D2006 +

+16
source share

you can use SelectDirectory from the FileCtrl module

 using FileCtrl; var St: string; begin St:='c:\'; if SelectDirectory(St,[],0) then begin end; end; 
+2
source share

You can download the PBFolderDialog component from http://bak-o-soft.dk/Delphi/PBFolderDialog.aspx , which is quite easy to use and offers access to all the parameters of the SHBrowseForFolder Windows dialog box; what the built-in doesn't do.

This is free software with source code and is not too difficult to port to Delphi 2009.

+1
source share

See sample code:


Delphi tip # 157: select the dialog of the folder http://www.scalabium.com/faq/dct0157.htm


0
source share

All Articles