Unreliable scroll of memo using vertscrollbar.position
Original Reporter info from Mantis: RCrosser
-
Reporter name: Russell Crosser
Original Reporter info from Mantis: RCrosser
- Reporter name: Russell Crosser
Description:
Bug in Memo scrolling.
Setup:
HP Laptop 15-bw0xx,
Windows 10, Lazarus 2.06, 2020-04-24
FPC 3.0.4 SVN Revision 62129
x86_64-win64-win32/win64
Problem: I am trying to scroll a memo accurately to a highlighted line by setting Memo1.VertScrollBar.Position = desired line number.
It generally works, but if I use the mouse scrollwheel to change the view, the positioning is no longer accurate, and the
highlighted text may be outside the visible area. This remains so through some further searches. The system corrects if
I manually scroll the vertical scrollbar to zero.
Workaround:
It works reliably if I use
SendMessage(Memo1.Handle, EM_LINESCROLL, 0, n - Memo1.VertScrollBar.Position)
Previous report?
A similar problem was reported in Lazarus forum:
Setting TMemo.VertScrollBar.Position does not scroll the text field
« on: November 22, 2015, 02:36:56 am »
That was where I got the workaround. It doesn't seem to be fixed, or it is a slightly different bug.
Russell Crosser russell.crosser@gmail.com
Steps to reproduce:
Set Memo1.VertScrollBar.Position to a chosen line beyond the last visible line. the memo scrolls to it. Use the mouse
scroll wheel to change the view downward (text going up), even by only 1 line. Set Memo1.VertScrollBar.Position to 0.
Memo scrolls to a low number, but the first line is not visible, along with zero to a few more lines. It remains inaccurate
through a few or many further iterations, but corrects itself if I scroll to the top with the vertical scrollbar.
Works fine if I don't use the wheel.
Additional information:
See sample program and screen dump.
Mantis conversion info:
- Mantis ID: 37673
- Build: SVN Revision 62129
- Version: 2.3 (SVN)