Vertical scroll position in TRichView

General TRichView support forum. Please post your questions here
Post Reply
Shouldercannon
Posts: 4
Joined: Sat Sep 21, 2019 1:35 pm

Vertical scroll position in TRichView

Post by Shouldercannon »

Please tell me how you can track the event when the scroll is at the very top in TRichView.
Attachments
scroll.png
scroll.png (4.51 KiB) Viewed 24232 times
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Vertical scroll position in TRichView

Post by Sergey Tkachenko »

OnVScrolled event, check VScrollPos property (it is in range 0...VScrollMax)
Shouldercannon
Posts: 4
Joined: Sat Sep 21, 2019 1:35 pm

Re: Vertical scroll position in TRichView

Post by Shouldercannon »

VScrolled works only once when the slider reaches the top.
Can I make the VScrolled event fire until the slider is scrolling up from the keyboard or mouse wheel?
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Vertical scroll position in TRichView

Post by Sergey Tkachenko »

OnVScrolled occurs on any scroll. Keyboard, scrollbar, mouse wheel, mouse panning, touch screen swipe - it does not matter, the event is called when a vertical position is changed.
Shouldercannon
Posts: 4
Joined: Sat Sep 21, 2019 1:35 pm

Re: Vertical scroll position in TRichView

Post by Shouldercannon »

I’ll clarify the question. So I scrolled the list with the mouse wheel up and the VScrolled event worked. I continue to scroll the list with the mouse wheel up, but again the VScrolled event no longer fires until I scroll down the speaker a little down, and then again up to the end.
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Vertical scroll position in TRichView

Post by Sergey Tkachenko »

I still do not understand.
OnVScrolled is called when vertical position (value of VScrollPos property) is changed. It does not matter how it is changed.
If you want to detect attempts to scroll further than possible (for example, scrolling to the top when document is already scrolled to the top), you can use:
- OnMouseWheel, OnMouseWheelUp, OnMouseWheelDown for mouse wheel
- OnCaretGetOut for pressing UP arrow at the top line or DOWN arrow at the bottom line.
Post Reply