Thema: ResCreator

Einzelnen Beitrag anzeigen

Benutzerbild von uligerhardt
uligerhardt

Registriert seit: 19. Aug 2004
Ort: Hof/Saale
1.735 Beiträge
 
Delphi 2007 Professional
 
#11

AW: ResCreator

  Alt 23. Nov 2011, 16:21
OS-abhängig Beide einbauen.
Ich hab mal schnell einen Wrapper zusammengeklatscht:
Delphi-Quellcode:
function SelectDirectory(const Caption: string;
  var Directory: string; Options: TSelectDirExtOpts; Parent: TWinControl): Boolean;
var
  dlg: TFileOpenDialog;
begin
  if (Win32MajorVersion >= 6) and UseLatestCommonDialogs then
  begin
    dlg := TFileOpenDialog.Create(nil);
    try
      dlg.Title := Caption;
      dlg.FileName := Directory;
      dlg.Options := dlg.Options + [fdoPickFolders];
      // Außerdem TSelectDirExtOpts auf TFileDialogOptions abbilden
      Result := dlg.Execute(Parent.Handle);
      if Result then
        Directory := dlg.FileName;
    finally
      dlg.Free;
    end;
  end
  else
  begin
    Result := FileCtrl.SelectDirectory(Caption, '', Directory, Options, Parent);
  end;
end;
Das kann man so aufrufen:
SelectDirectory('Test', Directory, [sdNewFolder, sdShowEdit, sdNewUI], Self);
Uli Gerhardt
  Mit Zitat antworten Zitat