Page 1 of 1
Bug in TButton
Posted: Sun Feb 19, 2006 3:41 pm
by Enrico Maria Giordano
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.
Code: Select all
#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
Posted: Sun Feb 19, 2006 6:39 pm
by Antonio Linares
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.
Posted: Sun Feb 19, 2006 6:56 pm
by Antonio Linares
This way it works:
Code: Select all
@ 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".
Posted: Sun Feb 19, 2006 7:23 pm
by Antonio Linares
This is a fix:
Code: Select all
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
Posted: Sun Feb 19, 2006 7:36 pm
by Enrico Maria Giordano
Thank you, but I suspect that some other problems is hiding under the wood...
EMG
Posted: Sun Feb 19, 2006 8:26 pm
by Antonio Linares
Enrico,
Yes, we'll see.
The problem is that Class TGet is quite different from Harbour to xharbour.
Posted: Mon Feb 20, 2006 5:00 pm
by Luis Krause
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 ::oGet: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 ::oGet:HasFocus
::DispText()
::oGet:Assign() // lkm
endif
::SetPos( ::oGet:Pos )
Return Self
Antonio Linares wrote:This is a fix:
Code: Select all
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
Posted: Mon Feb 20, 2006 5:18 pm
by Enrico Maria Giordano
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
Posted: Mon Feb 20, 2006 6:42 pm
by Antonio Linares
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.