Another bug in TWBrowse scrollbar

Another bug in TWBrowse scrollbar

Postby Enrico Maria Giordano » Sat Apr 21, 2007 9:46 am

Code: Select all  Expand view  RUN
#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: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Another bug in TWBrowse scrollbar

Postby Enrico Maria Giordano » Sat Apr 21, 2007 11:23 am

Code: Select all  Expand view  RUN
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
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sun Apr 22, 2007 5:44 am

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
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Sun Apr 22, 2007 7:07 am

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
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sun Apr 22, 2007 4:10 pm

Enrico,

This seems the right fix. Its just needed to change the order of the call to ::VSetPos()
Code: Select all  Expand view  RUN
...
         else

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

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

         endif
...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Sun Apr 22, 2007 4:32 pm

I confirm the fix, thank you!

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 37 guests