Skip to content

TMiletusStringList

Below is a list of the methods for TMiletusStringList. This class allows reading from files and writing to files. It's highly recommended to use the asynchronous load and save functions where possible.

Methods for TMiletusStringList

Property Description
LoadFromFile(const FileName: string) Loads the contents of the file from the local file system into a stringlist synchronously. Keep in mind that LoadFromFile will stop the code from futher execution until resolved.
LoadFromFileAsync(const FileName: string; AProc: TMiletusLoadFileProc) Loads the contents of the file from the local file system into a stringlist asynchronously.
SaveToFile(const FileName: string) Writes the contents of the stringlist into a file on the local file system synchronously. Keep in mind that SaveToFile will stop the code from futher execution until resolved.
SaveToFileAsync(const FileName: string) Writes the contents of the stringlist into a file on the local file system asynchronously.

Example 1: Open file contents using TMiletusStringList

procedure TForm1.WebButton1Click(Sender: TObject);
var
  sl: TMiletusStringList;
begin
  sl := TMiletusStringList.Create;
  sl.LoadFromFileAsync('path\to\file', procedure
  begin
    WebMemo1.Text := sl.Text;
    sl.Free;
  end);
end;

Example 2: Save to file using TMiletusStringList

procedure TForm1.WebButton1Click(Sender: TObject);
var
  sl: TMiletusStringList;
begin
  sl := TMiletusStringList.Create;
  try
    sl.Text := WebMemo1.Text;
    sl.SaveToFileAsync('path\to\file');
  finally
    sl.Free;
  end;
end;