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

Re: DocumentView confusion


On 11/16/25 10:43 AM, Gianluigi wrote:
Il 16/11/25 15:09, Gianluigi ha scritto:
Hi Fabien, gbWilly, and Lee,

I apologize for the intrusion, but to better understand you (us), I posted Fabien's test project here:
https://paste.c-net.org/UrgencyPulse
I used an old lecture by Professor Hans and incorporated it into the project.
It contains indexes, so I think the PDF is suitable.

For example, one question for Fabien could be this:

Public Sub Button1_Click()

   If (Val(TextBox1.Text) - 1) < 0 Then
     ' Assuming that FirstVisibleDocument and FirstVisiblePage are the same thing,
     ' why doesn't dv[dv.FirstVisiblePage].EnsureVisible do this?
     dv[0].EnsureVisible
   Else If (Val(TextBox1.Text) - 1) >= dv.Count Then
     ' Assuming that LastVisibleDocument and LastVisiblePage are the same thing,
     ' why doesn't dv[dv.LastVisiblePage].EnsureVisible do this?
     dv[dv.Max].EnsureVisible
   Endif


End

Regards
Gianluigi

I am currently looking at that example you posted. Button1 is used to go to the page number the user has entered into TextBox1.

I'm not sure what you are suggesting be asked. Why doesn't using .EnsureVisible on a page index do what exactly? If you mean ensure that the first or last page is visible, perhaps they would. Have you tested and found they do not?

The code in the project, "Try dv[Val(TextBox1.Text) - 1].EnsureVisible", is much simpler. Using Try makes testing if the value of TextBox1 (minus 1) is outside the bounds of the page indexes unnecessary. And just in case anyone is confused, "Else If (Val(TextBox1.Text) - 1) >= dv.Count Then" should actually be "Else If (Val(TextBox1.Text) - 1) > dv.Max Then".

To be used as an example project to everyone has common ground for discussion, the project should have another Button that prints out the values of the properties in question on-demand after the user has caused the page(s) in view to change. However, I think that for this particular discussion, that project may be unnecessarily complex.


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


Follow-Ups:
Re: DocumentView confusionGianluigi <gradobag@xxxxxxxxxxx>
References:
DocumentView confusiongbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: DocumentView confusionLee <t.lee.davidson@xxxxxxxxx>
Re: DocumentView confusiongbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: DocumentView confusionLee <t.lee.davidson@xxxxxxxxx>
Re: DocumentView confusionFabien Bodard <gambas.fr@xxxxxxxxx>
Re: DocumentView confusiongbWilly <gbWilly@xxxxxxxxxxxxxx>
Re: DocumentView confusionGianluigi <gradobag@xxxxxxxxxxx>
Re: DocumentView confusionGianluigi <gradobag@xxxxxxxxxxx>