Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help ESC
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00759032
Message ID:
00759123
Views:
21
>>>>>since I've installed vfp on a new system, the help file is no longer available. I even have developer network installed. I wanted to know how to disable the ESC key on a form.
>>>>>Thanks!!!
>>>>
>>>>Set Form.KeyPreview to .T. and put code to handle nKeyCode=27 in Form.KeyPress.
>>>
>>>I have a textbox that activates a dropdown box to display a picklist. If the user hits ESC during that time, the F1 key goes back to being 28. F1 is previously assigned to something else.
>>
>>I don't understand what F1 or 28 has to do with disabling ESC, or what you mean by "F1 goes back to being 28."
>>
>>INKEY() codes don't change. F1 is always 28. ESC is always 27.
>>
>>Are you saying your textbox has ON KEY LABEL F1 KEYBOARD "{ESC}" in its When event, or something like that?
>>
>>If the question is how to disable the ESC key on a form, the answer is to set the form's KeyPreview property to .T., and put code in the form's KeyPress event something like
IF m.nKeyCode=27
>>	NODEFAULT
>>ENDIF
If that's not the question, I guess I didn't understand your original message.
>>
>>HTH,
>
>Yes, in the keypress section I have "ON KEY LABEL F1 do form save"
>But the F1 reverts back to being 28 if the user hits ESC while in that certain textbox. Then hitting F1 puts a literal '28' in all the textboxes!
>then there's no way to properly exit the form
>:-(

I think I finally understand the problem.

You shouldn't put an ON KEY LABEL in the keypress section of the textbox.

You should put
IF m.nKeyCode=28
	*do stuff
ENDIF
in a Keypress method.

ON KEY LABEL commands override KeyPress events. Trying to combine the two can be pretty messy.
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing
Previous
Reply
Map
View

Click here to load this message in the networking platform