Bug in TWBrowse scrollbar

Bug in TWBrowse scrollbar

Postby Enrico Maria Giordano » Thu Apr 19, 2007 8:54 pm

This is the sample:

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

Re: Bug in TWBrowse scrollbar

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

Solved! Replace

Code: Select all  Expand view
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

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

Re: Bug in TWBrowse scrollbar

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

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

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

Postby Antonio Linares » Sun Apr 22, 2007 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

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

I don't know why you can't replicate the problem but try this:

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

Postby Antonio Linares » Sun Apr 22, 2007 4: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Sun Apr 22, 2007 4: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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Apr 23, 2007 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42078
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Mon Apr 23, 2007 9:38 am

Yes, thank you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
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 70 guests