TDialog bKeyChar and bKeyDown bugs

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

TDialog bKeyChar and bKeyDown bugs

Post by Enrico Maria Giordano »

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

Code: Select all

#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

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

Post by Antonio Linares »

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

Post by Enrico Maria Giordano »

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

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Enrico,

Yes, you are right :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply