Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-09

How do I do a Perform(EM_LINESCROLL, ?, ?) to scroll to the bottom of a Tmemo.

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter E Williams

Hi All,

I am porting some code from Delphi to lazarus and I needed to change a Trichedit to a Tmemo. Now the code

  with Memo2 do
    Perform(EM_LINESCROLL, 0, Memo_lines_added);

does not work. It is supposed to scroll the TMemo to the bottom of the window. I tried to use TRichView but it won't even display lines e.g. Richview1.lines.add( 'hello' ) does not work!!!

var
  Memo_lines.added : integer;
procedure Tform2.SnipMemoText(var Memo2 : tMemo; MaxSize : integer);
var
  i : integer;
begin
  // make it faster with BeginUpdate / EndUpdate {delete excess lines}
  Memo2.Lines.BeginUpdate;
  for i := 0 to Memo2.Lines.Count - MaxSize - 1 do
    Memo2.Lines.Delete(0);
  Memo2.Lines.EndUpDate;
  with Memo2 do
    Perform(EM_LINESCROLL, 0, Memo_lines_added);
  Memo_lines_added := 0;
end; { SnipMemoText }

Best Regards,
PEW
Hobart, Tasmania, Australia

Proudly developing Quality Cross Platform Open Source Games Since 1970 with a Commodore PET 4016 with 16 KRAM http://pews-freeware-games.org (<--- brand new)

Reply by email

Peter E Williams

Hi All,

Peter E Williams wrote 5 lines
Hi All, I am porting some code from Delphi to lazarus and I needed to change a Trichedit to a Tmemo. Now the code

This microsoft page:
http://msdn.microsoft.com/en-us/library/bb761615%28VS.85%29.aspx

gives the details of how it works for TRichEdits under MS Windows. All I am trying to do is add this functionality to TMemo under Lazarus. Can someone please help me with some code to do this?!?

// originally with RichEdit1 do
Show quoted text 11 lines
with Memo2 do Perform(EM_LINESCROLL, 0, Memo_lines_added); does not work. It is supposed to scroll the TMemo to the bottom of the window. I tried to use TRichView but it won't even display lines e.g. Richview1.lines.add( 'hello' ) does not work!!! var Memo_lines.added : integer; procedure Tform2.SnipMemoText(var Memo2 : tMemo; MaxSize : integer);
// originally var RichEdit2 : TRichEdit
Show quoted text 15 lines
var i : integer; begin // make it faster with BeginUpdate / EndUpdate {delete excess lines} Memo2.Lines.BeginUpdate; for i := 0 to Memo2.Lines.Count - MaxSize - 1 do Memo2.Lines.Delete(0); Memo2.Lines.EndUpDate; with Memo2 do Perform(EM_LINESCROLL, 0, Memo_lines_added); Memo_lines_added := 0; end; { SnipMemoText }

Best Regards,
PEW
Hobart, Tasmania, Australia

Proudly developing Quality Cross Platform Open Source Games Since 1970 with a Commodore PET 4016 with 16 KRAM http://pews-freeware-games.org (<--- brand new)

Reply by email

Antônio
to Peter E Williams

Try to use a SynMemo and set:

SynMemo.TopLine:= LineNumber;

Ant?nio

2010/9/3 Peter E Williams :

Show quoted text 61 lines
Hi All, On Fri, 2010-09-03 at 06:57 +1000, Peter E Williams wrote: > Hi All, > > I am porting some code from Delphi to lazarus and I needed to change a > Trichedit to a Tmemo. Now the code > This microsoft page: http://msdn.microsoft.com/en-us/library/bb761615%28VS.85%29.aspx gives the details of how it works for TRichEdits under MS Windows. All I am trying to do is add this functionality to TMemo under Lazarus. Can someone please help me with some code to do this?!? // originally with RichEdit1 do > ? with Memo2 do > ? ? Perform(EM_LINESCROLL, 0, Memo_lines_added); > > does not work. It is supposed to scroll the TMemo to the bottom of the > window. I tried to use TRichView but it won't even display lines e.g. > Richview1.lines.add( 'hello' ) does not work!!! > > var > ? Memo_lines.added : integer; > > procedure Tform2.SnipMemoText(var Memo2 : tMemo; MaxSize : integer); // originally var RichEdit2 : TRichEdit > var > ? i : integer; > begin > ? // make it faster with BeginUpdate / EndUpdate {delete excess lines} > ? Memo2.Lines.BeginUpdate; > ? for i := 0 to Memo2.Lines.Count - MaxSize - 1 do > ? ? Memo2.Lines.Delete(0); > ? Memo2.Lines.EndUpDate; > > ? with Memo2 do > ? ? Perform(EM_LINESCROLL, 0, Memo_lines_added); > > ? Memo_lines_added := 0; > end; { SnipMemoText } > Best Regards, ? ? ? ?PEW Hobart, Tasmania, Australia -- Proudly developing Quality Cross Platform Open Source Games Since 1970 with a Commodore PET 4016 with 16 KRAM http://pews-freeware-games.org (<--- brand new) -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email