I'm trying to build a basic teleprompter app ---- when I press page down, I'd like the view to jump to the next "page break" such that that page break is at the top of the new view.
Any way to do this?
Thanks,
David
How can I page down such that a pagebreak is at the top
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The following code scrolls the selection to the top:
Code: Select all
var ItemNo1, Offs1, ItemNo2, Offs2, X, Y: Integer;
begin
RichView1.GetSelectionBounds(ItemNo1, Offs1, ItemNo2, Offs2, True);
if ItemNo1<0 then
exit;
RichView1.GetItemCoords(ItemNo1, X, Y);
RichView1..ScrollTo(y);
end;
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Well, the code below does the same, but more precisely (if the selection is started not on the first line of the long text item, the previous code scrolls to the first line of this item; this code scrolls to the selection).
This code uses some undocumented methods.
The both methods do not work properly if the selection is in table cell, but I suppose this is not a problem for your application.
Code: Select all
uses DLines;
var ItemNo1, Offs1, ItemNo2, Offs2: Integer;
begin
RichView1.GetSelectionBounds(ItemNo1, Offs1, ItemNo2, Offs2, True);
if ItemNo1<0 then
exit;
RichView1.RVData.Item2DrawItem(ItemNo1, Offs1, ItemNo1, Offs1);
RichView1.ScrollTo(RichViewEdit1.RVData.DrawItems[ItemNo1].Top);
end;
The both methods do not work properly if the selection is in table cell, but I suppose this is not a problem for your application.