Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Software-Projekte der Mitglieder (https://www.delphipraxis.net/26-software-projekte-der-mitglieder/)
-   -   ResCreator (https://www.delphipraxis.net/164634-rescreator.html)

uligerhardt 23. Nov 2011 16:21

AW: ResCreator
 
Zitat:

Zitat von himitsu (Beitrag 1137553)
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:
Delphi-Quellcode:
SelectDirectory('Test', Directory, [sdNewFolder, sdShowEdit, sdNewUI], Self);

SimplySimon 23. Nov 2011 16:36

AW: ResCreator
 
Vielen dank! Werde es demnächst einbinden :)

Luckie 23. Nov 2011 17:03

AW: ResCreator
 
Und ab welcher Delphiversion läuft das? Ab wann steht TFileOpenDialog und UseLatestCommonDialogs zur Verfügung?

uligerhardt 23. Nov 2011 17:10

AW: ResCreator
 
Hab's noch ein bisschen überarbeitet:
Delphi-Quellcode:
function SelectDirectory(const Caption: string;
  var Directory: string; Options: TFileDialogOptions; 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 := Options + [fdoPickFolders];
      Result := dlg.Execute(Parent.Handle);
      if Result then
        Directory := dlg.FileName;
    finally
      dlg.Free;
    end;
  end
  else
  begin
    Result := FileCtrl.SelectDirectory(Caption, '', Directory, [sdNewFolder, sdShowEdit, sdShowShares, sdNewUI], Parent);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  UseLatestCommonDialogs := CheckBoxUseLatestCommonDialogs.Checked;
  if SelectDirectory('Test', Directory, [], Self) then
    Label1.Caption := Directory;
end;
Vielleicht kann man die beiden Option-Typen noch besser synchronisieren. Aber z.B. scheint sdShowShares nichts mit fdoShareAware zu tun zu haben, ebensowenig sdValidateDir mit fdoNoValidate, und mehr "Pärchen" habe ich auf die Schnelle nicht gefunden.

Zitat:

Zitat von Luckie (Beitrag 1137566)
Und ab welcher Delphiversion läuft das? Ab wann steht TFileOpenDialog und UseLatestCommonDialogs zur Verfügung?

Ich hab's mit D2007 ausprobiert.

Update: Wie zu erwarten lässt es sich mit Turbo Delphi nicht kompilieren.

SimplySimon 24. Nov 2011 20:49

AW: ResCreator
 
Hallo alle zusammen,

habe mich nochmal hingesetzt und die Version überarbeitet.
Es sind neue Funktionen hinzugekommen, einiges wurde verbessert, außerdem sollte jetzt auch
das Problem mit Windows XP gelöst sein.

SimplySimon 18. Jan 2012 19:52

Update (Version 1.3.4.20)
 
Kleines Update für zwischendurch. Habe noch ein paar kleine Fehler gefunden.


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:46 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz