Re: Which work event occurred

Giganews Newsgroups
Subject: Re: Which work event occurred
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Wed, 28 Dec 2005

"wahome" <rayha…@bigpond.net.au> wrote in message
news:8702197B61E7E240rayha…@bigpond.net.au...

> How do I get confirmation that a file has been uploaded or deleted.
> Below is how I imagine it is done.

Like every other command in Indy, the Put() and Delete() methods do not
return until the work is actually finished.  If you don't get an exception
thrown, then the operation completed successfully.

> procedure TForm1.IdFTP1WorkEnd(ASender: TObject;
> AWorkMode: TWorkMode);
> begin
>      If AWorkMode = ???? then
>        StatusBar1.SimpleText := 'File transferred successfully..';
>
>    If AWorkMode = ???? then
>        StatusBar1.SimpleText := 'File deleted successfully..';
> end;

That is the wrong way to approach the issue.  You should be doing this
instead:

    procedure TForm1.Button1Click(Sender: TObject);
    begin
        IdFTP1.Put(myfile);
        StatusBar1.SimpleText := 'File transferred successfully..';
    end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin
        IdFTP1.Delete(myfile);
        StatusBar1.SimpleText := 'File deleted successfully..';
    end;

Gambit

Replies

In response to

Which work event occurred posted by wahome on Thu, 29 Dec 2005