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

Re: DocumentView confusion


On Saturday, November 15th, 2025 at 11:57, gbWilly <gbWilly@xxxxxxxxxxxxxx> wrote:

> On Saturday, November 15th, 2025 at 00:09, Lee t.lee.davidson@xxxxxxxxx wrote:
> 
> > I thought I might investigate this but ......
> > 
> > How in the world does one load a document into DocumentView?
> 
> 
> Hi Lee,
> 
> Create a new project (add gb.poppler), Draw a DocumentView on the form and create a menu named mnuFileOpen, to open the pfd.
> The code below should get you started to get the pdf into the DocumentView. Set the DocumentView property ShowPages to true.
> 
> ----
> Private $hPdfFile As PdfDocument
> Private $iCurrentIndex As Integer
> 
> 
> Public Sub mnuFileOpen_Click()
> 
> Dialog.Path = User.Home
> If Not Dialog.OpenFile() Then
> LoadPdf(Dialog.Path)
> Endif
> 
> End
> 
> Public Sub DocumentView1_MouseWheel()
> 
> Debug "FirstVisiblePage: " & DocumentView1.FirstVisiblePage
> Debug "FirstVisibleDocument: " & DocumentView1.FirstVisibleDocument
> Debug "LastVisiblePage: " & DocumentView1.LastVisiblePage
> Debug "LastVisibleDocument: " & DocumentView1.LastVisibleDocument
> 
> $iCurrentIndex = DocumentView1.FirstVisibleDocument
> IconView1.Selection = [$iCurrentIndex]
> Debug "Current page: " & ($iCurrentIndex + 1)
> 
> End
> 

In above DocumentView1_MouseWheel leave out the line: IconView1.Selection = [$iCurrentIndex]

The IconView1 is something I have in my project I use the IconView to show the thumbnails of the pdf pages. This line of code ensures that when scrolling the mousewheel in the DocumentView, the thumbnail of shown page is selected in the IconView. Keeps the IconView and DocumentView in sync.

gbWilly


References:
DocumentView confusiongbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: DocumentView confusionLee <t.lee.davidson@xxxxxxxxx>
Re: DocumentView confusiongbWilly <gbWilly@xxxxxxxxxxxxxx>