FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TDialog:bValid bug
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
TDialog:bValid bug
Posted: Tue Mar 14, 2006 10:54 AM
This is the sample. Try to exit with ESC and you will get MsgInfo() two times:

#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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: TDialog:bValid bug
Posted: Tue Mar 14, 2006 11:22 AM
This is a possible fix (but please double check it):

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
TDialog:bValid bug
Posted: 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

Continue the discussion