Немного предыстории программы:
Программа использует интерфейс с вкладками для работы с несколькими файлами одновременно.
Я пытаюсь изменить каталог OpenDialog, чтобы каждый раз, когда я вызываю open, файл будет показывать каталог файла, над которым я работаю в настоящее время, но даже когда я устанавливаю InitialDir
на путь к файлу, он всегда отображает последний открытый каталог с файлами, а не тот, который я установил.
I tried the following:
if Length(CurrentFileName) > 0 then
begin
OpenFileDialog.InitialDir :='';
SetCurrentDirectory(PChar(CurrentFileName));
OpenFileDialog.InitialDir := ExtractFileDir(CurrentFileName);
end;
if OpenFileDialog.Execute then
...
Where CurrentFileName
is the full path with the filename of the current tab's opened file. But no luck.
Is there any way to achieve this?
So for example:
tab1
has c:\mydir\file.txt
opened
tab2
has d:\someotherdir\somefile.txt
opened
If I move to tab1
and call the open function I the OpenDialog
should show me the contents of c:\mydir\
I am using Delphi 7. Any help is appreciated.