FDXPDirectoryDialog.pas 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // FDXPOptions
  2. {
  3. Directory selection dialog for DXP.
  4. Licensed under MPL (http://www.mozilla.org/MPL/)
  5. Copyright 2003 - Eric Grange
  6. }
  7. unit FDXPDirectoryDialog;
  8. interface
  9. uses
  10. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  11. Dialogs, StdCtrls, ComCtrls, ShellCtrls;
  12. type
  13. TDXPDirectoryDialog = class(TForm)
  14. ShellTreeView: TShellTreeView;
  15. BUOk: TButton;
  16. BUCancel: TButton;
  17. private
  18. { Déclarations privées }
  19. public
  20. { Déclarations publiques }
  21. function Execute(edit : TEdit) : Boolean;
  22. end;
  23. function DXPDirectoryDialog(edit : TEdit) : Boolean;
  24. implementation
  25. {$R *.dfm}
  26. function DXPDirectoryDialog(edit : TEdit) : Boolean;
  27. begin
  28. with TDXPDirectoryDialog.Create(nil) do begin
  29. try
  30. Result:=Execute(edit);
  31. finally
  32. Free;
  33. end;
  34. end;
  35. end;
  36. function TDXPDirectoryDialog.Execute(edit : TEdit) : Boolean;
  37. begin
  38. try
  39. ShellTreeView.Path:=edit.Text;
  40. except
  41. // ignore issues
  42. end;
  43. Result:=(ShowModal=mrOk);
  44. if Result then
  45. edit.Text:=ShellTreeView.Path;
  46. end;
  47. end.