Page 1 of 1

Another bug in TWBrowse scrollbar

Posted: Sat Apr 21, 2007 9:46 am
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

Re: Another bug in TWBrowse scrollbar

Posted: Sat Apr 21, 2007 11:23 am
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

Posted: Sun Apr 22, 2007 5:44 am
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).

Posted: Sun Apr 22, 2007 7:07 am
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

Posted: Sun Apr 22, 2007 4:10 pm
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
...

Posted: Sun Apr 22, 2007 4:32 pm
by Enrico Maria Giordano
I confirm the fix, thank you!

EMG