Difference between revisions of "TFtpClient.OnProgress"
Jump to navigation
Jump to search
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Main_Page | Main page]] -> [[ICS_Components_Reference | ICS components reference]] | [[Main_Page | Main page]] -> [[ICS_Components_Reference | ICS components reference]] | ||
| − | -> [[ | + | -> [[TFtpClient]] -> [[TFtpClient.OnProgress | OnProgress]] |
== Definition == | == Definition == | ||
procedure('''Sender''': TObject; '''Count''' : LongInt; var '''Abort''' : Boolean) of object; | procedure('''Sender''': TObject; '''Count''' : LongInt; var '''Abort''' : Boolean) of object; | ||
Latest revision as of 16:42, 7 November 2006
Main page -> ICS components reference -> TFtpClient -> OnProgress
Definition
procedure(Sender: TObject; Count : LongInt; var Abort : Boolean) of object;
- Sender : the client which fired the event
- Count : the filesize count
- Abort : Used to abort the transfer
Description
This event fires to indicate the fileprogress.
Example
Before you transfer the file retrieve the filesize and set it to the progressbar max property:
Progress.Max := getFileSize(FilenameEdit.Text);
In the event of progress do something like this:
procedure TMainForm.FtpClientProgress(Sender: TObject; Count: Integer; var Abort: Boolean); begin Progress.Position := Count; end;
This is the getFileSize-function
function getFileSize(pFileName: string): longint;
var
sr: TSearchRec;
FileAttrs: Integer;
begin
FileAttrs := faReadOnly;
FileAttrs := FileAttrs + faHidden;
FileAttrs := FileAttrs + faSysFile;
FileAttrs := FileAttrs + faVolumeID;
FileAttrs := FileAttrs + faDirectory;
FileAttrs := FileAttrs + faArchive;
FileAttrs := FileAttrs + faAnyFile;
if FindFirst(pFileName, FileAttrs, sr) = 0 then
begin
Result := sr.Size;
FindClose(sr);
end
else
Result := 0;
end;
Best practices
nothing yet