>>Hi Bernard.. >> >>Here is an example that works... >> >>DO WHILE >> *-- Wait 0.5 second for a keypress >> nWait = INKEY(0.5,"H") >> IF nWait <> 0 >> *-- Key pressed, EXIT loop >> EXIT >> ENDIF >> >> Some code.... >> >>ENDDO >> > >My code is similar. The problem is that FPW2.6a comes up with this error when the INKEY() function itself is evaluated nWait = INKEY(0.5,"H") > >"Function argument value, type, or count is invalid" (ERROR#11) > >So there is no use evaluating the nWait variable to see if it is <> 0 as the program bombs at the line where there is INKEY(), before returning any result to nWait!! > >I want to know if this is a bug or not.
Bernard,
I struggled with inkey() in vfp 5. Finally, I replaced all my inkey()s to the following function:
func MYINKEY priv tul, verror
* VFP 5.0 bug: if next line commented out, the following error * occurs sometimes and inkey() statement is not executed: * function argument, value, type or count is invalid * in fpw 2.5 it works. havent tried this in vfp 6 verror =on('error') on error NOTE tul = inkey() on error &verror if type('m.tul')!='N' return .f. endif return m.tul == 27