[lazarus] How to scroll TMemo control in code

Marc Weustink marc at dommelstein.net
Thu Mar 27 18:12:47 EST 2003

At 07:02 28-3-2003 +0800, you wrote:
>Can anybody try help me figure out how to scroll the TMemo programatically?
>I have seen this code in Delphi, though I am not sure if it works (in Delphi)
>procedure MemoScrollDown(Memo: TMemo);
>  ScrollMessage:TWMVScroll; (I replace this one with TLMVScroll)
>  i:integer;
>  ScrollMessage.Msg:=WM_VScroll; (this one with LM_VScroll)
>  for i := 0 to Memo.Lines.Count do
>  begin
>      ScrollMessage.ScrollCode:=sb_LineDown;
>      ScrollMessage.Pos:=0;
>   Memo.Dispatch(ScrollMessage);
>  end;
>If I try the above code, it does not do anything.


It might work in Delphi, but it doesn't in the LCL (and never will)

Some background info:

The widgetset of you choice (GTK, win32, QT, GNOME) may be message based or 
event based or whatever to signal when the user does something. The 
interface object of the LCL translates this to LCL-Messages (and object 
calls) to be a bit Delphi compatible so that Delphi code based on messages 
would work (code for WM_LBUTTONDOWN etc). This is thus from userinterface 
to code.
However the otherway around, the LCL doesn't translate messages from code 
to the user interface.


More information about the Lazarus mailing list