Page 1 of 1
Scroll Past End of Doc
Posted: Wed Aug 18, 2021 4:04 pm
by standay
Hi Sergey,
Is there a way to scroll an rve past the end line? I tried rvoScrollToEnd but I don't see it doing anything.
In my scintilla control, I can set it to scroll to the end of the text:
- scroll to end.png (33.7 KiB) Viewed 10704 times
Or, scroll past the end:
- scroll past end.png (15.14 KiB) Viewed 10704 times
I'd like to get the rve to scroll
past the end if possible.
Thanks Sergey
Re: Scroll Past End of Doc
Posted: Thu Aug 19, 2021 10:12 am
by Sergey Tkachenko
If you simply want to scroll, you can call
or
(in FMX version, ScrollTo is renamed to ScrollToPosition).
If you want to move the caret to the end of the document, you can do it
Code: Select all
var
ItemNo, Offs: Integer;
ItemNo := rve.ItemCount - 1;
Offs := rve.GetOffsAfterItem(ItemNo);
rve.SetSelectionBounds(ItemNo, Offs, ItemNo, Offs);
or
PS: rvoScrollToEnd is used by rv.FormatTail; it may be useful to implement chats.
Re: Scroll Past End of Doc
Posted: Thu Aug 19, 2021 5:58 pm
by standay
I was actually wanting to scroll past the end of the doc, beyond the last line of actual text. But I doubt the rve does that. Not a big deal, be nice if it did but no problem.
The scroll code was helpful, thanks. I was just about to try and figure out how to scroll to the end of the doc today so that saved me some time.
Stan
Re: Scroll Past End of Doc
Posted: Thu Sep 16, 2021 9:44 pm
by standay
Hi Sergey,
I was playing around with this today and I got the rve to do just what I wanted. I put a copy of RVScroll.pas into my app's folder, then, in that copy, I changed line 817:
to:
Code: Select all
if FVscrollVisible then
FVScrollMax := YSize - 1 + (FVScrollPage-4);
This gives me the effect I want. LibreOffice and Word do the same thing in a way. When you are in "normal" view mode, you can scroll the whole page up and down regardless of how much text is on it.
My guess is the Scale rve does that too, but I have not used that one yet. What I did above is for a plain rve.
Could you try it and take a look at it and see what you think? I think you'll see right away what I'm after. What I have works fine, but I have no idea of the interaction with other parts of the component which was why I was hoping you could look at it.
I would say if it looked like something you could implement, that you could add an option to TCustomRichView.Options
Code: Select all
rvoScrollPastEnd, // if set, vertical scrolling will scroll beyond the end of text
Thanks Sergey. No hurry on this.
Stan
Re: Scroll Past End of Doc
Posted: Sat Sep 18, 2021 6:30 pm
by Sergey Tkachenko
I think it's better to implement this effect by increasing value of BottomMargin property.
Re: Scroll Past End of Doc
Posted: Sat Sep 18, 2021 8:16 pm
by standay
Sergey Tkachenko wrote: ↑Sat Sep 18, 2021 6:30 pm
I think it's better to implement this effect by increasing value of BottomMargin property.
This is why I ask about these things! Yes, that's a much simpler way and seems to work the same. BTW, I like being able to scroll past the end (or scroll the bottom up or however you want to think of it) as it makes it easier to edit text at the bottom of the document since you can scroll it up into view to work on.
Thanks Sergey. Great idea. I would never have thought to use the bottom margin.
Stan