Paint page - associated item

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

Paint page - associated item

Post by Jim Knopf » Mon Dec 04, 2017 3:13 pm

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: 185
Joined: Mon Dec 30, 2013 10:07 pm
Location: Austria
Contact:

Re: Paint page - associated item

Post by Jim Knopf » Mon Dec 04, 2017 3:50 pm

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 » Sun Apr 07, 2019 10:04 am

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: 14550
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Paint page - associated item

Post by Sergey Tkachenko » Sun May 19, 2019 11:22 am

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