1. Computing

Scrolling Memo text from code

From , former About.com Guide

If you need to scroll the text in a Memo control, use the following procedure:

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure MemoScrollDown(Memo: TMemo) ;
var
  ScrollMessage:TWMVScroll;
  i:integer;
begin
  ScrollMessage.Msg:=WM_VScroll;
  for i := 0 to Memo.Lines.Count do
  begin
   ScrollMessage.ScrollCode:=sb_LineDown;
   ScrollMessage.Pos:=0;
   Memo.Dispatch(ScrollMessage) ;
  end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Ever needed to set some additional properties to the standard Memo component? By default you use the Tmemo when you need a standard Windows multiline edit control on a form. Here are some nifty TMemo related tips and tricks

Delphi tips navigator:
» Abort a loop by pressing a key
« Label: FocusControl

©2013 About.com. All rights reserved.