Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inkey() returns only 0
Message
De
18/07/2008 20:52:45
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01332212
Message ID:
01332443
Vues:
14
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform