Bug in TButton

Bug in TButton

Postby Enrico Maria Giordano » Sun Feb 19, 2006 3: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.

Code: Select all  Expand view  RUN
#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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sun Feb 19, 2006 6: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.
Last edited by Antonio Linares on Sun Feb 19, 2006 7:24 pm, edited 1 time in total.
regards, saludos

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

Postby Antonio Linares » Sun Feb 19, 2006 6:56 pm

This way it works:
Code: Select all  Expand view  RUN
    @ 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sun Feb 19, 2006 7:23 pm

This is a fix:
Code: Select all  Expand view  RUN
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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Sun Feb 19, 2006 7:36 pm

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

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

Postby Antonio Linares » Sun Feb 19, 2006 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Luis Krause » Mon Feb 20, 2006 5: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 ::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  Expand view  RUN
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
Code: Select all  Expand view  RUN


Regards,

Luis
"May the Source be with GNU"
User avatar
Luis Krause
 
Posts: 59
Joined: Tue Oct 11, 2005 1:39 am
Location: Vancouver, Canada

Postby Enrico Maria Giordano » Mon Feb 20, 2006 5: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
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Mon Feb 20, 2006 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
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 90 guests