>I’m using this code in a click method of a form and trying to get escape but the ? shows the same values regardless of what I press. I have the KeyPreview = .t.
>
>DO WHILE 1 = 1
>
> IF ctr > 50
> EXIT
> ENDIF
>
> ?INKEY(), LASTKEY(), CHRSAW()
>
> IF INKEY() = 27
> EXIT
> ENDIF
>ENDDO
>
>
>but my ? only shows 0 13 .f. regardless of what key I press
From help on inkey():
"Parameters
nSeconds
Specifies the number of seconds to wait for a keystroke. If you do not specify a value for nSeconds, INKEY( ) returns a value for a keystroke immediately. If nSeconds is 0, INKEY( ) waits indefinitely for a keystroke."
So... give it a zero for a parameter, or else it won't wait, and your chances of lifting your finger off a key at exactly the right moment are pretty much nil.