FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in TButton
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TButton
Posted: Thu Mar 02, 2006 05:42 PM
Running the following sample you can see that it shows the message "cVar2 is empty" if ALT-C is pressed (but not if the button is clicked):

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oGet1, cVar1 := SPACE( 30 )
    LOCAL oGet2, cVar2 := SPACE( 30 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET oGet1 VAR cVar1

    oGet1:bLostFocus = { || cVar2 := "Test", oGet2:Refresh() }

    @ 2, 1 GET oGet2 VAR cVar2

    @ 3, 1 BUTTON "&Close";
           ACTION IF( !EMPTY( cVar2 ), oDlg:End(), MSGINFO( "cVar2 is empty" ) )

    ACTIVATE DIALOG oDlg;
             CENTER

    ? cVar2

    RETURN NIL


A possible fix:

METHOD Click() CLASS TButton

   if ! ::lProcessing
      ::lProcessing = .t.

      if ::bAction != nil
         ::SetFocus()  ///EMG
         Eval( ::bAction )
      endif

      if ! ::lCancel .and. ::oWnd:hWnd != 0  // A.L. 21/04/03
         Super:Click()
      endif                 // A.L. 21/04/03

      // Hernan Ceccarelli added 10-Junio-2001
      if ( GetFocus() == ::hWnd )
         ::PostMsg( BM_SETSTYLE, BS_DEFPUSHBUTTON, 1 )
      else
         if ! ::lDefault
            ::PostMsg( BM_SETSTYLE, BS_PUSHBUTTON, 1 )
         endif
      endif
      // Hernan Ceccarelli added 10-Junio-2001

      ::lProcessing = .f.
   endif

return nil


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TButton
Posted: Thu Mar 02, 2006 06:32 PM

Thanks Enrico! :)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion