TDialog bKeyChar and bKeyDown bugs

TDialog bKeyChar and bKeyDown bugs

Postby Enrico Maria Giordano » Mon Apr 10, 2006 9:20 am

This is the sample. Try to hit ESC. Is it expected?

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE( 30 )

    DEFINE DIALOG oDlg

    oDlg:bKeyChar = { || MsgInfo( "bKeyChar" ) }
    oDlg:bKeyDown = { || MsgInfo( "bKeyDown" ) }

    @ 1, 1 GET cVar

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


This is a possible solution:

Code: Select all  Expand view  RUN
METHOD KeyChar( nKey, nFlags ) CLASS TDialog

   if nKey == VK_ESCAPE
//      if ! Empty( ::bKeyChar )
//         Eval( ::bKeyChar, nKey, nFlags, Self )
//      endif   

...

METHOD KeyDown( nKey, nFlags ) CLASS TDialog

   if nKey == VK_ESCAPE
//      if ! Empty( ::bKeyDown )
//         Eval( ::bKeyDown, nKey, nFlags, Self )
//      endif   
//      if ! Empty( ::bKeyDown )
//         Eval( ::bKeyDown, nKey, nFlags, Self )
//      endif   

...


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

Postby Antonio Linares » Mon Apr 10, 2006 9:53 am

Enrico,

IMO the bKeyDown and bKeyChar events should be processed even if ESC is pressed. What do you think ?
regards, saludos

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

Postby Enrico Maria Giordano » Mon Apr 10, 2006 10:03 am

Decision is yours (of course) but I think this would cause a serious backward compatibility problem.

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

Postby Antonio Linares » Mon Apr 10, 2006 10:30 am

Enrico,

Yes, you are right :)
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: SantaCroya and 71 guests