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

Antônio antoniog12345 at gmail.com
Sat Sep 4 02:33:21 CEST 2010


Try to use a SynMemo and set:

SynMemo.TopLine:= LineNumber;

Antônio

2010/9/3 Peter E Williams <foss.game.pascal.developer at iinet.net.au>:
> 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
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>




More information about the Lazarus mailing list