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
Different behaviour in FWH/FW in GET...ON CHANGE
-
- Posts: 5
- Joined: Sun Nov 26, 2006 11:03 am
Patrick
I made this simple modification in the TGET Class for me:
Works for me, but in the library de problem continue.
I made this simple modification in the TGET Class for me:
Code: Select all
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
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
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. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
This may be a more complete fix:
Code: Select all
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