FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in TButton
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TButton
Posted: Sun Feb 19, 2006 03:41 PM
The following sample shows the problem. Try to put any character in the GET and then hit ALT-C. You will see that the DIALOG won't close. On the contrary, if you click on the button the DIALOG will close.

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE( 20 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET cVar;
           VALID !EMPTY( cVar )

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

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TButton
Posted: Sun Feb 19, 2006 06:39 PM

Enrico,

On a first review it looks as a Harbour vs xharbour related issue.

With Harbour it works ok :)

It seems a difference between Harbour/xharbour Class TGet.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TButton
Posted: Sun Feb 19, 2006 06:56 PM
This way it works:
    @ 1, 1 GET cVar; 
           VALID ( oDlg:aControls[ 1 ]:Assign(), !EMPTY( cVar ) )

So it seems that with xharbour the ::oGet DATA has not been assigned, thats why it remains "empty".
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TButton
Posted: Sun Feb 19, 2006 07:23 PM
This is a fix:
METHOD lValid() CLASS TGet

   local lRet := .t.

   if ::oGet:BadDate
      ::oGet:KillFocus()
      ::oGet:SetFocus()
      MsgBeep()
      return .f.
   else
      ::oGet:Assign()    // New !!!
      if ValType( ::bValid ) == "B"
         lRet := Eval( ::bValid, Self  )
         if ! lRet
            ::oWnd:nLastKey = 0
         endif
      endif
   endif

return lRet
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TButton
Posted: Sun Feb 19, 2006 07:36 PM

Thank you, but I suspect that some other problems is hiding under the wood... :-(

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TButton
Posted: Sun Feb 19, 2006 08:26 PM

Enrico,

Yes, we'll see.

The problem is that Class TGet is quite different from Harbour to xharbour.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 59
Joined: Tue Oct 11, 2005 01:39 AM
Bug in TButton
Posted: Mon Feb 20, 2006 05:00 PM
Antonio:

The last time I sent you a suggested fix in TGet [I forgot what it was
about :-) ], I pasted a modified version of ::EditUpdate() I've been using for several years now and in which I added the call to ::assign()
to ensure the Clipper/[x]Harbour buffer was always in sync with FW/FWH's.
That could be an alternate fix for this problem:

METHOD EditUpdate() CLASS TGet

if ::HasFocus
::DispText()
::Assign() // lkm
endif

::SetPos( ::Pos )

Return Self


Antonio Linares wrote:This is a fix:
METHOD lValid() CLASS TGet

   local lRet := .t.

   if ::oGet:BadDate
      ::oGet:KillFocus()
      ::oGet:SetFocus()
      MsgBeep()
      return .f.
   else
      ::oGet:Assign()    // New !!!
      if ValType( ::bValid ) == "B"
         lRet := Eval( ::bValid, Self  )
         if ! lRet
            ::oWnd:nLastKey = 0
         endif
      endif
   endif

return lRet


Regards,

Luis
"May the Source be with GNU"
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TButton
Posted: Mon Feb 20, 2006 05:18 PM
Antonio Linares wrote:Enrico,

Yes, we'll see.

The problem is that Class TGet is quite different from Harbour to xharbour.


After some tests it seems all ok with your fix.

Thank you.

EMG
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Bug in TButton
Posted: Mon Feb 20, 2006 06:42 PM

Luis,

The fact is that Class TGet is different in Harbour and xharbour, thats why we need to asure that before we validate a GET, its related variable has been assigned. Placing it at lValid() is a way to be sure it gets done.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion