Page 1 of 1

Hot to scroll

Posted: Tue Nov 25, 2014 6:12 pm
by RichardDufour
How would I go about to scroll to the very top or my ScaleRichview?

I unsuccessfully tried the following:
A) srv.RichViewEdit.ScrollTo(0);
B) srv.RichViewEdit.VScrollPos := 0;
C) srv.VScrollPos := 0;
Etc.

but nothing will make it scroll to the very top.

Furthermore, why would I use
A) srv.RichViewEdit.VScrollPos := 0;
VS
B) srv.VScrollPos := 0;

A bit confusing.
Which one has precedence over the other? What's the difference?
What am I doing wrong? What do I have to do to scroll to the top?

Thanks in advance for any input you can provide,
Richard

Posted: Tue Nov 25, 2014 6:16 pm
by RichardDufour
BTW, I also unsuccessfully tried this:

// Set the scroll position to the top
ItemNo := 0;
Offs := srv.RichViewEdit.GetOffsBeforeItem(ItemNo);
srv.RichViewEdit.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);

But also didn't work.
:-(

Posted: Wed Nov 26, 2014 9:57 am
by Sergey Tkachenko
This code works:

Code: Select all

SRichViewEdit1.VScrollPos := 0;
What problem do you have with it?

srv.RichViewEdit.VScrollPos := 0 and srv.RichViewEdit.ScrollTo(0) are incorrect, because scrolling in internal editor does not initiate scrolling in SRV.

SetSelectionBounds scrolls to make the caret visible, so the first line will be visible after moving the caret to the beginning. But it is not necessary scrolls to the very top, because of margins and a gap between the top side and pages.