filetail OnFileAppended event
Return to Introduction  Previous page  Next page
Applies to
dcFileTail component.  

Declaration
type  
  TdcFileTailFileAppendedEvent = procedure(Sender: TObject; AppendedData: TStream) of object;  
 
property OnFileAppended: TdcFileTailFileAppendedEvent;  

Description
The OnFileAppended event occurs when the file size has been changed AND the new file size is more than previous size (let's suppose that some data has been appended to the end of file).  
 
If you want to retrieve appended data - use AppendedData parameter. This is usual TMemoryStream.  

Example (adding appended data to the TMemo)
procedure TForm1.dcTail1FileAppended(Sender: TObject;  
  AppendedData: TStream);  
 
  function StreamToString(Stream: TStream): String;  
  var  
    Len: DWord;  
  begin  
    with Stream do  
     begin  
      Len := Size - Position;  
      SetLength(Result, Len);  
      Read(Result[1], Len);  
     end;  
  end;  
 
begin  
  Memo1.Lines.Add(StreamToString(AppendedData));  
end;  

See also
OnFileChanged event.  
File not found.