Antonio,
Meanwhile I found out that the problem is caused by the function lastkey().
I usually use this in my dialog boxes :
- Code: Select all Expand view
REDEFINE BUTTON ID 901 OF oDlg ACTION (cRet:=.T.,oDlg:End()
REDEFINE BUTTON ID 902 OF oDlg ACTION (cRet:=.F.,oDlg:END()
// These buttons define the OK and CANCEL
ACTIVATE DIALOG oDlg CENTERED
IF GETKEYSTATUS() ; cRet := .F. ; ENDIF
GETKEYSTATUS() checks if Escape has been pressed. The results is the same as the CANCEL button.
So the problem comes from the GETKEYSTATUS() function.
This is the function I use :
- Code: Select all Expand view
FUNCTION GetKeyStatus
LOCAL StatRet := .F.
SYSREFRESH()
IF LastKey() = VK_ESCAPE
StatRet := .T.
ENDIF
SYSREFRESH()
RETURN(StatRet)
But it looks like the LastKey()-function is maintaining VK_ESCAPE, although other keys on my keyboard have been pressed on.
I changed this function to :
- Code: Select all Expand view
FUNCTION GetKeyStatus(StRet)
LOCAL kRet := .F.
DEFAULT(StRet,.F.)
IF GetAsyncKey(VK_ESCAPE)
IF StRet .OR. LastKey() = VK_ESCAPE
kRet := .T.
ENDIF
ENDIF
SYSREFRESH()
RETURN(kRet)
This function mostly runs fine, except that I have to push VK_ESCAPE twice or tree times sometimes before any reaction is seen.
Any idea ?
Thanks.