mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:39:31 +02:00
fixed ofFileMustExist fro SelectDirectoryDialog
git-svn-id: trunk@8285 -
This commit is contained in:
parent
6a279a35e4
commit
c6be2bbf11
@ -177,6 +177,7 @@ type
|
||||
protected
|
||||
procedure DereferenceLinks; virtual;
|
||||
function CheckFile(var AFilename: string): boolean; virtual;
|
||||
function CheckFileMustExist(const AFileName: string): boolean; virtual;
|
||||
function CheckAllFiles: boolean; virtual;
|
||||
function DoExecute: boolean; override;
|
||||
public
|
||||
@ -203,7 +204,7 @@ type
|
||||
|
||||
TSelectDirectoryDialog = class(TOpenDialog)
|
||||
protected
|
||||
function CheckFile(var AFilename: string): boolean; override;
|
||||
function CheckFileMustExist(const AFilename: string): boolean; override;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
end;
|
||||
|
@ -132,11 +132,9 @@ begin
|
||||
exit;
|
||||
end;
|
||||
if (ofFileMustExist in Options)
|
||||
and (not FileExists(AFilename)) then begin
|
||||
and (not CheckFileMustExist(AFileName)) then begin
|
||||
// CheckFileMustExists shows message dialog
|
||||
Result:=false;
|
||||
MessageDlg(rsfdFileMustExist,
|
||||
Format(rsfdFileNotExist,[AFileName]),mtError,
|
||||
[mbCancel],0);
|
||||
exit;
|
||||
end;
|
||||
if ofNoReadOnlyReturn in Options then begin
|
||||
@ -157,6 +155,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TOpenDialog.CheckFileMustExist(const AFileName: string): boolean;
|
||||
begin
|
||||
if not FileExists(AFilename) then begin
|
||||
Result:=false;
|
||||
MessageDlg(rsfdFileMustExist,
|
||||
Format(rsfdFileNotExist,[AFileName]),mtError,
|
||||
[mbCancel],0);
|
||||
end else
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TOpenDialog.CheckAllFiles: boolean;
|
||||
var
|
||||
AFilename: String;
|
||||
@ -265,17 +274,15 @@ begin
|
||||
FTitle:=rsfdSelectDirectory;
|
||||
end;
|
||||
|
||||
function TSelectDirectoryDialog.CheckFile(var AFilename: string): boolean;
|
||||
function TSelectDirectoryDialog.CheckFileMustExist(const AFilename: string): boolean;
|
||||
begin
|
||||
if (ofFileMustExist in Options)
|
||||
and (not DirPathExists(AFilename)) then begin
|
||||
if not DirPathExists(AFilename) then begin
|
||||
Result:=false;
|
||||
MessageDlg(rsfdDirectoryMustExist,
|
||||
Format(rsfdDirectoryNotExist,[AFileName]),mtError,
|
||||
[mbCancel],0);
|
||||
exit;
|
||||
end;
|
||||
Result:=inherited CheckFile(AFilename);
|
||||
end else
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user