[lazarus] How to scroll TMemo control in code
Mattias Gaertner
nc-gaertnma at netcologne.de
Thu Mar 27 18:28:34 EST 2003
On Fri, 28 Mar 2003 00:32:12 +0100
Marc Weustink <marc at dommelstein.net> wrote:
> 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);
> >var
> > ScrollMessage:TWMVScroll; (I replace this one with TLMVScroll)
> > i:integer;
> >begin
> > 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;
> >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.
Right.
I think, we should add some properties to TCustomMemo to control the
scrollbars.
Other components need them too, so we should do that in an independent way.
Ideas?
Mattias
More information about the Lazarus
mailing list