[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DocumentView confusion


On attached image you can see code run during a scroll of the mousewheel to retrieve on what page of a loaded pdf in a DocumentView is shown.

DocumentView.png

There are 4 properties that I would like to discuss as they are, at least, confusing. I'm talking about:
- FirstVisibleDocument (Return the number of the first visible page in the viewer.)
- FirstVisiblePage (Return the index of the first visible page.)
- LastVisibleDocument (Return the number of the last visible page in the viewer.)
- LastVisiblePage (Return the index of the last visible page.)

To my understanding of the matter (correct me where I'm wrong), the index is 1 lower that the actual page number (shown on the DocumentView by setting its ShowPage property to True)
Page 1 -> Index 0
Page 2 -> Index 1
Page 3 -> Index 2
...

If you look at the screenshot of my running code where I open a pdf in a DocumentView. I scroll down a bit to make page 2 visible, still being on page 1.
The code of the debug output in console of this slight scroll down, can be seen in image above the console output.

FirstVisiblePage returns 0 when on page 1 (expected as it says Return the index of the first visible page.)
FirstVisibleDocument returns 0 when on page 1 (I expected the page number, although index would make more sense here and page number would make more sense for FirstVisiblePage, just by the sound of the name)
  • seems both are the same. Is this by design or by mistake?

LastVisibleDocument returns 2 when page 2 is visible (expected as It says return the number of teh last visible page)
LastVisiblePage returns 2 when page 2 is visible (I expected 1 as index for page 2)
  • seems both are the same. Is this by design or mistake?

In short:
Both First.. properties return the index
Both Last... properties return the page number
...VisiblePage talks about index in wiki
...VisibleDocument talks about number in wiki

Something is off (Gambas 3.19.6), please enlighten me..

gbWilly

GambOS
Gambas3 for Debian/Ubuntu

...there is always a Catch if things go wrong!

Sent with Proton Mail secure email.

Follow-Ups:
Re: DocumentView confusiongbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: DocumentView confusionLee <t.lee.davidson@xxxxxxxxx>