GET WITH "ON CHANGE" PROBLEM

GET WITH "ON CHANGE" PROBLEM

Postby Boris » Thu Apr 20, 2006 12:00 am

We are using:
xHarbour built 01/24/06
All FWH libraries from 03/15/06

We have GET problem (simplified, it looks like this):
At the entering to dialog:
nSalary := 7,500.00
cText := "SOME TEXT"
....
REDEFINE GET oGet1 VAR nSalary ID 101 OF oDlg ;
ON CHANGE (cText := "CHANGED",oget2:SetText(cText),oget2:refresh()) UPDATE

REDEFINE GET oget2 VAR cText ID 102 OF oDlg UPDATE
....

Now, if we click into the oGet1 GET field and just hit enter to continue,
the cText becomes "CHANGED" and oGet2 is refreshed with this content.
Even if we DID NOT CHANGE the content of oGet1 VAR nSalary !!

Basicaly what happens is that no mater if the "nSalary" variable IS changed or NOT
after we leave it by hitting ENTER or TAB, the "ON CHANGE" clause evaluates
as TRUE and because of this, the rest of code
is evaluated (changes variable cText to "CHANGED")
and oGet2 GET shows "CHANGED" on dialog!

Is there a fix for this, or there is something which was changed either in xHArbour
or FWH?

Thanks for any help or advice
User avatar
Boris
 
Posts: 16
Joined: Sun Nov 27, 2005 1:57 am

Re: GET WITH "ON CHANGE" PROBLEM

Postby E. Bartzokas » Thu Apr 20, 2006 6:18 pm

Boris wrote:...
Basicaly what happens is that no mater if the "nSalary" variable IS changed or NOT
after we leave it by hitting ENTER or TAB, the "ON CHANGE" clause evaluates
as TRUE and because of this, the rest of code
is evaluated (changes variable cText to "CHANGED")
and oGet2 GET shows "CHANGED" on dialog!

Is there a fix for this, or there is something which was changed either in xHArbour
or FWH?

Thanks for any help or advice


Boris,
I do not expect any response, due to the fact that it's too hard to find out why this is happening.
I have solved the problem, and have sent you an updated TGET.PRG though your private email.

If any one cares to know how I solved it, then here's a brief description....
In Method KeyChar of TGET.PRG, I evaluate the code blocks for ON CHANGE, only if the original content of the variable is changed.
I use:
IF (::oGet:changed .or. ::oGet:unTransform() <> ::oGet:original)
lAccept = Eval( ::bChange, nKey, nFlags, Self )
...
ENDIF

This IF-ENDIF has been added in both
case nKey == VK_TAB .and. GetKeyState( VK_SHIFT )
and in
case nKey == VK_TAB .or. nKey == VK_RETURN

Regards to all and Happy Easter to the Orthodox Christians.

Evans Bartzokas

ps. Yes, we create a PDF from inside our modified RPREVIEW.PRG, and Yes, we e-mail this PDF as an attachment.
:D
User avatar
E. Bartzokas
 
Posts: 114
Joined: Tue Feb 14, 2006 8:13 am
Location: Corinth, Greece

Postby Antonio Linares » Thu Apr 20, 2006 6:57 pm

Boris,

As Evans has pointed, this may be the required fix in Class TGet:
Code: Select all  Expand view  RUN
      case nKey == VK_TAB .or. nKey == VK_RETURN
           if ::bChange != nil .and. ( ::oGet:Changed .or. ::oGet:UnTransform() != ::oGet:Original )
              lAccept = Eval( ::bChange, nKey, nFlags, Self )
              if ValType( lAccept ) == "L" .and. lAccept
                 ::oWnd:GoNextCtrl( ::hWnd )
              endif
           else
              ::oWnd:GoNextCtrl( ::hWnd )
           endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42113
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 45 guests