Herzlich willkommen in der Delphi-PRAXiS, learner90.
Zum
Indy Projekt gibt es ein paar Demos - darunter auch einen
FTP-Client. Beim Doppelklick auf einen Directory-Eintrag wird folgende Funktion (INDY9) aufgerufen:
Delphi-Quellcode:
procedure TMainForm.ChageDir(DirName: String);
Var
LS: TStringList;
begin
LS := TStringList.Create;
try
SetFunctionButtons(false);
// Hier reagierst du auf '..'
if DirName = '..'
then IdFTP1.ChangeDirUp
else IdFTP1.ChangeDir(DirName);
IdFTP1.TransferType := ftASCII;
CurrentDirEdit.Text := IdFTP1.RetrieveCurrentDir;
DirectoryListBox.Items.Clear;
IdFTP1.List(LS);
DirectoryListBox.Items.Assign(LS);
// Und hier baust du '..' ein:
if CurrentDirEdit.Text <> '/' then
DirectoryListBox.Items.Insert(0, '..');
if DirectoryListBox.Items.Count > 0 then
if AnsiPos('total', DirectoryListBox.Items[0]) > 0 then DirectoryListBox.Items.Delete(0);
finally
SetFunctionButtons(true);
LS.Free;
end;
end;
Getippt und nicht getestet.
Freundliche Grüße vom marabu