2011. április 15., péntek

How to make a TOpenDialog display folders only


Problem/Question/Abstract:

Delphi has a TOpenDialog to choose files, but I need an open dialog to choose folders only.

Answer:

function DirectorySelect: string;
var
  dir_name: string;
  Options: TSelectDirOpts;
begin
  options := [];
  if SelectDirectory(dir_name, Options, 0) then
    Result := dir_name
  else
    Result := '';
end;

Nincsenek megjegyzések:

Megjegyzés küldése