Recent

Author Topic: [SOLVED] Scroll TMemo to a specific line number.  (Read 5426 times)

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
[SOLVED] Scroll TMemo to a specific line number.
« on: July 10, 2017, 01:55:47 pm »
During a find, I've got the found search string highlighted in a memo, and the find pauses with a dialog box. However the location of the found string is anywhere on the screen, sometimes hiding behind the dialog box >:(.

CaretPos.Y is giving me the line SelStart is on, so I then can calculate the desired line to be the first visible line. But the question is, what is the command to get the memo to scroll to a certain line number to be the first visible line in the window.

Thanks

Bazza



« Last Edit: September 09, 2017, 06:51:23 am by Bazzao »
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Scroll TMemo to a specific line number.
« Reply #1 on: July 10, 2017, 02:12:50 pm »
for Windows you can control the topline by setting VerticalScrollBar.Position value
Code: [Select]
  Memo1.VertScrollBar.Position:=nnn;
Ultimately (for Windows) VertScrollBar for Memo works based of the number of lines.

Bazzao

  • Full Member
  • ***
  • Posts: 178
  • Pies are squared.
Re: Scroll TMemo to a specific line number.
« Reply #2 on: July 10, 2017, 02:23:45 pm »
Definitely an improvement, but not accurate. But I can live with that offer. :)

Many thanks.
Bazza

Lazarus 2.0.10; FPC 3.2.0; SVN Revision 63526; x86_64-win64-win32/win64
Windows 10.

 

TinyPortal © 2005-2018