Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inkey() returns only 0
Message
From
18/07/2008 20:52:45
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01332212
Message ID:
01332443
Views:
16
>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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform