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

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

Postby patrickmast2 » 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
patrickmast2
 
Posts: 5
Joined: Sun Nov 26, 2006 11:03 am

Postby Rochinha » Thu Feb 15, 2007 3:45 pm

Patrick

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

Code: Select all  Expand view
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.
Rochinha
 
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo

Postby driessen » Thu Feb 15, 2007 4: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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby James Bott » Thu Feb 15, 2007 5: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Thu Feb 15, 2007 5:46 pm

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

Postby patrickmast2 » Thu Feb 15, 2007 8:49 pm

Thank you Antonio.
patrickmast2
 
Posts: 5
Joined: Sun Nov 26, 2006 11:03 am

Postby Rochinha » Sat Feb 17, 2007 6:34 am

My thanks too!
Rochinha
 
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests