Hi Sergey,
a novel project in Patchwork contains a lot of RVF files (for each scene one) that are compiled to one ScaleRichView document to publish.
Now I want to give the possibility to the authors to let paint a picture per chapter behind the text. Chapters always starts on a new page. Basically it works fine at PaintPage event (I did it at the few first pages, the preliminaries) but ... how can I detect that a new chapter starts?
On the one side there is the loop that collects all the RVFs that should be 'filled' into the whole document. On the other side there is the PaintPage event. There I don't have any information which item belongs to the page. It would be fine to know in the PaintPage event, which item is the first of the page.
I know, it's a little elaborately and I hope you understand my problem
Paint page - associated item
Re: Paint page - associated item
Okay, I think it's possible via GetPageStartItemNo and a reference list, built wihle looping - sorry.
-
- Posts: 1
- Joined: Wed Apr 03, 2019 6:59 pm
- Location: Bulgaria
- Contact:
Paint page associated item
If Ive got a document loaded into an SRV and a list of items in the document with ItemNo values, how can I get the Page#, Line#, and Col# of each ItemNo? I just need the starting Page# and Line#.
-
- Site Admin
- Posts: 17520
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Paint page - associated item
I am sorry for a late answer. If you are still interested.
To get a page of the specific item, use TSRichViewEdit.GetItemPages.
Unfortunately, there is no method that returns Line# and Col# for the specific position, only for the current caret position.
You can see the source code of TSRichViewEdit.GetCurrentLineCol, it calculates Line# and Col# for the position (ActiveEditor.CurItemNo, ActiveEditor.OffsetInCurItem). You can copy and modify it to calculate for (ItemNo, RichViewEdit.GetOffsBeforeItem(ItemNo)) for the given ItemNo.
To get a page of the specific item, use TSRichViewEdit.GetItemPages.
Unfortunately, there is no method that returns Line# and Col# for the specific position, only for the current caret position.
You can see the source code of TSRichViewEdit.GetCurrentLineCol, it calculates Line# and Col# for the position (ActiveEditor.CurItemNo, ActiveEditor.OffsetInCurItem). You can copy and modify it to calculate for (ItemNo, RichViewEdit.GetOffsBeforeItem(ItemNo)) for the given ItemNo.