replaced TopenDialog with TSelectDirectoryDialog

git-svn-id: trunk@5174 -
This commit is contained in:
mattias 2004-02-05 13:56:57 +00:00
parent caff68648f
commit e06d1ce300

View File

@ -44,7 +44,7 @@ type
AddTemplateButton: TButton; AddTemplateButton: TButton;
OkButton: TButton; OkButton: TButton;
CancelButton: TButton; CancelButton: TButton;
OpenDialog: TOpenDialog; BrowseDialog: TSelectDirectoryDialog;
procedure AddTemplateButtonClick(Sender: TObject); procedure AddTemplateButtonClick(Sender: TObject);
procedure BrowseButtonClick(Sender: TObject); procedure BrowseButtonClick(Sender: TObject);
procedure CancelButtonClick(Sender: TObject); procedure CancelButtonClick(Sender: TObject);
@ -118,17 +118,17 @@ end;
procedure TPathEditorDialog.BrowseButtonClick(Sender: TObject); procedure TPathEditorDialog.BrowseButtonClick(Sender: TObject);
var y: integer; var y: integer;
NewPath: string;
begin begin
if OpenDialog=nil then OpenDialog:=TOpenDialog.Create(Self); if BrowseDialog=nil then begin
with OpenDialog do begin BrowseDialog:=TSelectDirectoryDialog.Create(Self);
BrowseDialog.Options := BrowseDialog.Options + [ofFileMustExist];
end;
with BrowseDialog do begin
Title:=lisPathEditSelectDirectory; Title:=lisPathEditSelectDirectory;
if (not Execute) then exit; if (not Execute) then exit;
NewPath:=ExtractFilePath(Trim(Filename));
if (not DirPathExists(NewPath)) then exit;
y:=PathEdit.CaretY; y:=PathEdit.CaretY;
if y>PathEdit.Lines.Count then y:=PathEdit.Lines.Count; if y>PathEdit.Lines.Count then y:=PathEdit.Lines.Count;
PathEdit.Lines.Insert(y,NewPath); PathEdit.Lines.Insert(y,Trim(Filename));
PathEdit.CaretY:=y+1; PathEdit.CaretY:=y+1;
end; end;
SelectCurrentPath; SelectCurrentPath;