Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inkey() returns only 0
Message
From
18/07/2008 09:55:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
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:
01332255
Views:
11
>Sorry but I'm not following you.

The idea is to run an infinite loop (note the condition); interrupt if the user presses a certain key. Since this is not related to any TextBox, inkey() seems to make more sense. I have done similar things in the past, but I don't know why this particular code wouldn't work.

Mike, for an infinite loop, instead of
do while 1 = 1
you can use the simpler
do while .T.
>>I need to stop the loop after it has been clicked.
>>
>>
>>>Why not use KeyPress event ?
>>>
>>>>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
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform