Another bug in TWBrowse scrollbar

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Another bug in TWBrowse scrollbar

Post by Enrico Maria Giordano »

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    USE TEST

    DEFINE DIALOG oDlg

    @ 0, 0 LISTBOX oBrw FIELDS

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:SetControl( oBrw );
             CENTER

    CLOSE

    RETURN NIL
Try to press PAGEDOWN and then PAGEUP: the scrollbar should go back to the top but it doesn't.

EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Another bug in TWBrowse scrollbar

Post by Enrico Maria Giordano »

Code: Select all

METHOD PageUp( nLines ) CLASS TWBrowse

   local nSkipped

   DEFAULT nLines := ::nRowCount()

   nSkipped = ::Skip( -nLines )

   if ( ::nLen := Eval( ::bLogicLen, Self ) ) < 1
      return nil
   endif

   if ! ::lHitTop
      if nSkipped == 0
         ::lHitTop = .t.
      else
         ::lHitBottom = .f.
         if -nSkipped < nLines
            ::nRowPos = 1
            if ::oVScroll != nil
               ::VSetPos( 1 )
            endif
         else

            //nSkipped = ::Skip( -nLines )
            //::Skip( -nSkipped )
Commenting out those last two statements seems to solve the problem but I'm not sure if this is the right fix. Antonio, please review.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

> Try to press PAGEDOWN and then PAGEUP: the scrollbar should go back to the top but it doesn't.

In Vista is working fine without modifying the method. Going to try it in XP (edited: same behavior in XP).

How many records Test.dbf has ? (Here just 2).
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

No, you will see the problem only when you have a certain amount of record. I tried with xHarbour sample TEST.DBF that has 500 record.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

This seems the right fix. Its just needed to change the order of the call to ::VSetPos()

Code: Select all

...
         else

            if ::oVScroll != nil
               ::VSetPos( ::VGetPos() + nSkipped )
            endif

            nSkipped = ::Skip( -nLines )
            ::Skip( -nSkipped )

         endif
...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply