Event OnNeedInfo

Occurs when there is any information that needed by component

type TMFtpInfoNeeded = (niAccount, niHost, niLocalFile, niOverwrite, niPassword, niUser); 
type TMFtpInfoNeededEvent = procedure (Sender: TObject; need: TMFtpInfoNeeded; var Value: String) of Object;

property OnFtpNeedInfo: TMFtpInfoNeededEvent;

Applied to

TMFtp

Example

procedure TForm1.MyFtpNeedInfo;
begin
   case
need of
      { set default account, username and password }
      niAccount: Value := 'guest';
      niUsername: Value := 'anonymous';
      niPassword: Value := 'guest@microsoft.com';

      { determine the local name of the file being downloaded }
      niLocalFile:
      begin
        with SaveDialog1 do
        begin
            Filter := 'All Files|*.*';
            Filename := Value;
            if Execute then Value := Filename;
        end;
      end;

      { determine whether the file will be overwritten }
      niOverwrite:
      begin
         with
ConfirmForm do
         begin
           
ButtonResume := MFtp1.SupportResume;

            ShowModal;

            case Tag of
               0: Value := 'Cancel';       // Cancel current download/upload operation
               1: Value := 'Overwrite'; // Overwrite the file
               2: Value := 'Resume';    // Resume broken download/upload
            end;
         end;

      end;
   end;
end;