Search results for 'Directory Selection'. 1 post(s) found.
There are FileOpenDialog and FileSaveDialog components on Delphi VCL.
Sometimes you may need Directory Selection dialog, but no components are found on VCL.
Do you know Delphi provides the solution as SelectDirectory().
Here are two examples for Directory Selection.
Following shows directory structure under d:\delphi
procedure TForm1.Button1Click(Sender: TObject);
var
DirSelected: string;
begin
if SelectDirectory('Select a folder:', 'D:\Delphi', DirSelected) then
ShowMessage('You selected ' + DirSelected)
else
ShowMessage('You did not select a folder');
end;
var
DirSelected: string;
begin
if SelectDirectory('Select a folder:', 'D:\Delphi', DirSelected) then
ShowMessage('You selected ' + DirSelected)
else
ShowMessage('You did not select a folder');
end;
Following shows driver names and files as well as directory structure.
procedure TForm1.Button2Click(Sender: TObject);
var
Dir: string;
begin
Dir := 'D:\Delphi';
if SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], 0) then
ShowMessage('You selected ' + Dir)
else
ShowMessage('You did not select a folder');
end;
var
Dir: string;
begin
Dir := 'D:\Delphi';
if SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt], 0) then
ShowMessage('You selected ' + Dir)
else
ShowMessage('You did not select a folder');
end;
Another posts included in "Delphi"
| How to launch application ? (0) | 2009/09/09 |
| How to print external document ? (0) | 2009/09/09 |
| Delphi API to get windows temporary directory (0) | 2009/09/03 |
| Delphi API to get the current working directory (0) | 2009/09/03 |
| How to resize PNG file in Delphi ? (0) | 2009/09/03 |

Prev

Rss Feed