Paint page - associated item

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Paint page - associated item

Post by Jim Knopf »

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 :?
Jim Knopf
Posts: 241
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Re: Paint page - associated item

Post by Jim Knopf »

Okay, I think it's possible via GetPageStartItemNo and a reference list, built wihle looping - sorry.
FrankBardy
Posts: 1
Joined: Wed Apr 03, 2019 6:59 pm
Location: Bulgaria
Contact:

Paint page associated item

Post by FrankBardy »

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#.
Sergey Tkachenko
Site Admin
Posts: 17236
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Paint page - associated item

Post by Sergey Tkachenko »

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.
Post Reply