TDialog:bValid bug

TDialog:bValid bug

Postby Enrico Maria Giordano » Tue Mar 14, 2006 10:54 am

This is the sample. Try to exit with ESC and you will get MsgInfo() two times:

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


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE( 20 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET cVar

    @ 3, 1 BUTTON "&Close";
           ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:bValid := { || MsgInfo(), .T. };
             CENTER

    RETURN NIL


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

Re: TDialog:bValid bug

Postby Enrico Maria Giordano » Tue Mar 14, 2006 11:22 am

This is a possible fix (but please double check it):

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

   if nKey == VK_ESCAPE
      if ::oWnd == nil
//         ::End()  //EMG
      else
         if ::oWnd:ChildLevel( TMdiChild() ) != 0
            ::End()
         else
            if ::oWnd:ChildLevel( TDialog() ) != 0
               ::End()
            #ifdef __HARBOUR__
            elseif Upper( ::oWnd:ClassName() ) == "TMDIFRAME" // To avoid ESC being ignored
               ::End()
            #endif
            else
               return Super:KeyChar( nKey, nFlags )
            endif
         endif
      endif
   else
      return Super:KeyChar( nKey, nFlags )
   endif

return nil


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

Postby Antonio Linares » Tue Mar 14, 2006 12:38 pm

Enrico,

Thanks! :)

We have been messing lately with ESC and this looks as a side effect.
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests