FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Different behaviour in FWH/FW in GET...ON CHANGE
Posts: 5
Joined: Sun Nov 26, 2006 11:03 AM

Different behaviour in FWH/FW in GET...ON CHANGE

Posted: Thu Feb 15, 2007 12:43 PM

Hello,

In Clipper, no matter what the ON CHANGE returns, TAB or ENTER positions the cursor in the next GET.
In xHarbour, the ON CHANGE needs to return .T. before ENTER brings the cursor to the next GET.

Please try this sample:

/*

oGet1 has an onChange wich does NOT return .T.
-> By changing value in oGet1 en pressing ENTER, cursor stays in oGet1 <<- WRONG
-> By changing value in oGet1 en pressing TAB, cursor goes to oGet2

oGet2 has an onChange wich DOES return .T.
-> By changing value in oGet2 en pressing ENTER, cursor goes to oGet3
-> By changing value in oGet2 en pressing TAB, cursor goes to oGet2

*/

include "FiveWin.ch"

Function wfMain()
LOCAL oDlg
LOCAL oGet1, oGet2, oGet3
LOCAL cGet1, cGet2, cGet3:=""

cGet1:="Change this text en press Enter"
cGet2:="Change this text en press Enter"

DEFINE DIALOG oDlg TITLE "Test" FROM 0, 0 TO 300,400 PIXEL

@ 10, 10 GET oGet1 VAR cGet1 OF oDlg PIXEL SIZE 150, 10;
ON CHANGE (cGet3+="On Change cGet1: Cursor stays in oGet1!!"+CRLF, oGet3:Refresh()) ;
VALID (cGet3+="Valid cGet1"+CRLF, oGet3:Refresh(), .T.) ;

@ 30, 10 GET oGet2 VAR cGet2 OF oDlg PIXEL SIZE 150, 10;
ON CHANGE (cGet3+="On Change cGet2: Cursor goes to next field"+CRLF, oGet3:Refresh(), .T.) ;
VALID (cGet3+="Valid cGet2"+CRLF, oGet3:Refresh(), .T.) ;

@ 50, 10 GET oGet3 VAR cGet3 OF oDlg MEMO PIXEL SIZE 150, 50

ACTIVATE DIALOG oDlg CENTERED

RETURN NIL

--
Sincerely,

Patrick Mast

www.xHarbour.com

Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM

Different behaviour in FWH/FW in GET...ON CHANGE

Posted: Thu Feb 15, 2007 03:45 PM
Patrick

I made this simple modification in the TGET Class for me:

METHOD KeyChar( nKey, nFlags ) CLASS TGet
      ...
      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 // isolated
                 ::oWnd:GoNextCtrl( ::hWnd )
              //endif // isolated
           else
              ::oWnd:GoNextCtrl( ::hWnd )
           endif


Works for me, but in the library de problem continue.
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM

Different behaviour in FWH/FW in GET...ON CHANGE

Posted: Thu Feb 15, 2007 04:10 PM

Patrick,

I am migrating my FW16-application to xHarbour and I just noticed today the same problem. It also happens when using the VALID clause.

Rochinha, thanks a lot for your help. I added the changed TGET.PRG to my PRG-files and it's working fine now.

Michel

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Different behaviour in FWH/FW in GET...ON CHANGE

Posted: Thu Feb 15, 2007 05:15 PM

Keep in mind that the Windows standard is to move from field to field with the Tab key and the Enter key triggers the default pushbutton which is usually the OK button. This allows users to enter data and close the dialog without using the mouse or tabbing through all the fields (as they had to do in DOS apps).

I know when converting DOS apps your users will be used to using the Enter key for field movement, and they WILL complain if you take this away. But most of the other applications they work with do not use the Enter key for movement so you will really being doing them a favor by making them get used to using the Tab key. In my experience you won't hear any more complaints after a week or two.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Different behaviour in FWH/FW in GET...ON CHANGE

Posted: Thu Feb 15, 2007 05:46 PM
This may be a more complete fix:
METHOD KeyChar( nKey, nFlags ) CLASS TGet 
      ... 
      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"
                 if lAccept
                    ::oWnd:GoNextCtrl( ::hWnd ) 
                 endif 
              else
                 ::oWnd:GoNextControl( ::hWnd )
              endif      
           else 
              ::oWnd:GoNextCtrl( ::hWnd ) 
           endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 5
Joined: Sun Nov 26, 2006 11:03 AM

Different behaviour in FWH/FW in GET...ON CHANGE

Posted: Thu Feb 15, 2007 08:49 PM

Thank you Antonio.

Posts: 310
Joined: Sun Jan 08, 2006 10:09 PM

Different behaviour in FWH/FW in GET...ON CHANGE

Posted: Sat Feb 17, 2007 06:34 AM

My thanks too!

Continue the discussion