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:
Or, scroll past the end:
I'd like to get the rve to scroll past the end if possible.
Thanks Sergey
Scroll Past End of Doc
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Scroll Past End of Doc
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
or
PS: rvoScrollToEnd is used by rv.FormatTail; it may be useful to implement chats.
Code: Select all
rv.VScrollPos := rv.VScrollMax
Code: Select all
rv.ScrollTo(rv.DocumentHeight)
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);
Code: Select all
rve.MoveCaret(rvcmBottom);
Re: Scroll Past End of Doc
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
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
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:
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
Thanks Sergey. No hurry on this.
Stan
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:
Code: Select all
FVScrollMax := YSize - 1;
Code: Select all
if FVscrollVisible then
FVScrollMax := YSize - 1 + (FVScrollPage-4);
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
Stan
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Scroll Past End of Doc
I think it's better to implement this effect by increasing value of BottomMargin property.
Re: Scroll Past End of Doc
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.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.
Thanks Sergey. Great idea. I would never have thought to use the bottom margin.
Stan