FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in TWBrowse scrollbar
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TWBrowse scrollbar
Posted: Thu Apr 19, 2007 08:54 PM
This is the sample:

#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 CTRL-C or CTRL-R and you will see that the scrollbar thumb will move, respectively, down and up (while the highlight bar keep holding on the first record).

EMG
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TWBrowse scrollbar
Posted: Sat Apr 21, 2007 09:42 AM
Solved! Replace

METHOD KeyChar( nKey, nFlags ) CLASS TWBrowse

   do case
      case nKey == K_PGUP
           ::oVScroll:PageUp()

      case nKey == K_PGDN
           ::oVScroll:PageDown()

      otherwise
           return Super:KeyChar( nKey, nFlags )
   endcase

return 0


with

METHOD KeyChar( nKey, nFlags ) CLASS TWBrowse

   do case
      case nKey == VK_PRIOR
           ::oVScroll:PageUp()

      case nKey == VK_NEXT
           ::oVScroll:PageDown()

      otherwise
           return Super:KeyChar( nKey, nFlags )
   endcase

return 0


EMG
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TWBrowse scrollbar
Posted: Sat Apr 21, 2007 11:06 AM

Or, even better, just remove KeyChar method from TWBrowse class. It seems not needed.

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TWBrowse scrollbar
Posted: Sun Apr 22, 2007 05:40 AM

Enrico,

>
Try to press CTRL-C or CTRL-R and you will see that the scrollbar thumb will move, respectively, down and up (while the highlight bar keep holding on the first record).
>

We have removed Class TWBrowse Method KeyChar() following your advise, thanks. Tested in Vista but when Ctrl+C or Ctrl+R are pressed nothing happens (edited: same behavior in XP). Maybe that behavior is not implemented in Vista.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TWBrowse scrollbar
Posted: Sun Apr 22, 2007 07:15 AM
I don't know why you can't replicate the problem but try this:

METHOD KeyChar( nKey, nFlags ) CLASS TWBrowse

   do case
      case nKey == K_PGUP
           ::oVScroll:PageUp()
? nKey, K_PGUP
      case nKey == K_PGDN
           ::oVScroll:PageDown()
? nKey, K_PGDN
      otherwise
           return Super:KeyChar( nKey, nFlags )
   endcase

return 0


Don't you see the same value for nKey and for K_PGUP or K_PGDN?

Try with few records.

EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TWBrowse scrollbar
Posted: Sun Apr 22, 2007 04:14 PM

Enrico,

We removed Method KeyChar() following your advise and everything seems to work fine. Anyhow Ctrl+C and Ctrl+R do nothing here.

What are those keystrokes intended for ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TWBrowse scrollbar
Posted: Sun Apr 22, 2007 04:26 PM

Are you saying that the KeyChar method is not invoked when you press CTRL-C or CTRL-R? It is invoked here. Anyway, CTRL-C and CTRL-R is not intended for anything. Just they caused the scrollbar to move due to the typo K_PGUP/K_PGDN (Clipper keys) instead of VK_PRIOR/VK_NEXT (Windows keys). That's all.

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TWBrowse scrollbar
Posted: Mon Apr 23, 2007 09:35 AM

Enrico,

I see. Well as we have removed Method KeyChar() then it should be fine now :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TWBrowse scrollbar
Posted: Mon Apr 23, 2007 09:38 AM

Yes, thank you.

EMG

Continue the discussion