The Filedialog behave strang.
If you open the dialog with a set file, the dialog set the directory to the correct path.
If you change the directory and reopen the dialog, the first used directory is used instead of the directory of the actual file.
Please change following
var
IssetIntern: Boolean;
begin
...
else if (InitialDir = '') then
begin
IsSetIntern := True;
SetInitialDir(LMDExtractFilePath(AFileName));
end;
....
FileDlg.FileName := LMDExtractFileName(AFileName); // No change of AFileName-Variable
....
// Reset to Initial Value
if IsSetIntern and (LMDExtractFilePath(AFileName) = InitialDir) then
SetInitialDir('');
Comments