Jump to content
Sign in to follow this  
Gustav Schubert

Memo.ShowScrollBars

Recommended Posts

I have a Memo on my Form the content of which is updated often, programatically. It contains no more than a few lines, ScrollBars should never appear, by design, so I set property ShowScrollBars to False, when reviewing the code.
 

But I needed to reverse the setting (should be true), because - if not - the user can scroll the content out of view, off the top edge of the control!
 

( My app in a nutshell will allow the user to select the current parameter, and then change the value of that parameter with the mouse wheel, when shift or ctrl is down. A normal mouse wheel delta will continue to be available for normal scrolling, of content in a Memo or Listbox, as expected. )
 

( I also searched in quality portal, and found that the most relevant entry already had a test case project attached, uploaded by - guess who. RSP-12137 - FMX Memo Scrolling Bug. )
 

I attach the new test app here (zipped form), for "future reference".

MemoWheelTest.zip

Share this post


Link to post

A Hello World program featuring TMemo, holding exactly one line of text, which is initially hidden - but which can be scrolled into view, interactively! I think this a now a finished piece.

 

( When you see the empty Memo, scroll the mouse wheel over the Memo, away from yourself, or click. )

 

unit Unit1;

interface

uses
  System.SysUtils,
  System.UITypes,
  FMX.Types,
  FMX.Controls,
  FMX.Forms,
  FMX.Memo;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    Memo: TMemo;
    Timer: TTimer;
    procedure TimerTimer(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Memo := TMemo.Create(Self);
  Memo.Parent := Self;

  Timer := TTimer.Create(Self);
  Timer.OnTimer := TimerTimer;
end;

procedure TForm1.TimerTimer(Sender: TObject);
var
  i: Integer;
begin
  Memo.Position.X := 10;
  Memo.Position.Y := 10;
  Memo.Width := 300;
  Memo.Height := 300;

  Memo.ControlType := TControlType.Styled;
  Memo.StyledSettings := [];
  Memo.TextSettings.Font.Family := 'Courier New';
  Memo.TextSettings.Font.Size := 24;
  Memo.TextSettings.FontColor := TAlphaColors.Red;

  Memo.ShowScrollBars := False;

  for i := 0 to 15 do
  begin
    Memo.Lines.Add('');
  end;
  Memo.Lines.Clear;

  Memo.Lines.Add('Hello World');
  Caption := 'Memo.Lines.Count = ' + IntToStr(Memo.Lines.Count);
  Timer.Enabled := False;
  Memo.ScrollTo(0, 1000);
end;

end.

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×