Board index » delphi » TMemo.Lines.LoadFromStream - Append line?

TMemo.Lines.LoadFromStream - Append line?

Is it possible to append Memo lines instead of overwrite all the
existing lines when calling LoadFromStream Method?

Regards,
Chris Lee

 

Re:TMemo.Lines.LoadFromStream - Append line?


In message <380292f1.588964...@forums.borland.com>, Chris Lee stated:
Quote
> Is it possible to append Memo lines instead of overwrite all the
> existing lines when calling LoadFromStream Method?

Load them into a temporary TStringList and then use
Memo.Lines.AddStrings(TmpStringList);

--
Regards
Ralph (TeamB)
--

Re:TMemo.Lines.LoadFromStream - Append line?


On Tue, 12 Oct 1999 10:03:56 +0200, "Ralph Friedman (TeamB)"

Quote
<ralphfried...@email.com> wrote:
>In message <380292f1.588964...@forums.borland.com>, Chris Lee stated:
>> Is it possible to append Memo lines instead of overwrite all the
>> existing lines when calling LoadFromStream Method?

>Load them into a temporary TStringList and then use
>Memo.Lines.AddStrings(TmpStringList);

>--

Ralph,

Thanks for your answers, however I found some characters will missing
and unwanted CR appear by the following code. Any Hints?

Regards,
Chris Lee

--- Code sample -

procedure TForm1.FormCreate(Sender: TObject);
begin
  FfileStream := TFileStream.Create('C:\TEMP\TEST.LOG', fmOpenRead +
fmShareDenyNone);
  Memo1.Lines.LoadFromStream(fFileStream);
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  FfileStream.Free;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  StringList: TStringList;
begin
  StringList := TStringList.Create;
  try
    StringList.LoadFromStream(FfileStream);
    Memo1.Lines.AddStrings(StringList);
  finally
    StringList.Free;
  end;
end;
- eof -

Re:TMemo.Lines.LoadFromStream - Append line?


In message <3804e79c.676175...@forums.borland.com>, Chris Lee stated:
Quote
> Thanks for your answers, however I found some characters will missing
> and unwanted CR appear by the following code. Any Hints?

Chris,

no hints at all. I don't understand why there would be missing
characters. The "unwanted" carriage returns may have to do with the
width of the lines you are loading v. the display width of the memo.
Try (if you haven't already) adding a horizontal scroll bar to the memo
and see if that changes things (I guess I had 1 hint after all<g>).
--
Regards
Ralph (TeamB)
--

Other Threads