Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using function key (F10) in KEYPRESS event of form 1

Status
Not open for further replies.

kimsue

Programmer
Mar 5, 2002
52
US
I have used the application wizard to create my first application in Visual Foxpro 7.0. In the KEYPRESS event of my forms, I would like to check for the operator pressing F10 function key (nkeyCode = -9). In my Foxpro 2.6 applications, this key is used to display a popup selection for the active field. The whole process works if I change the function key to F5 (nkeycode = -5), but I cannot get F10 to work. I am assuming there is something in the framework that is causing this, but I have not yet been able to find it. Any ideas? Thanks in advance for your help.
 
HI
1. The nKeyVode value for F5 is -6. (If that works with -5, it appears strange. The F4 will produce that value).
2. It is likely, that you have your ON KEY LABEL F10 statement made available somewhere in your code. So when you press the F10 key, that is performed. You can check that by select a text box.. and in its got focus event. put the code.. PUSKKEY. Then while running the form in that text box.. press F10 and observe if that works.
Another way is to add the code in the KeyPress event..
WAIT WINDOW STR(nKeyCode) and see what is the value returned when the F10 is pressed and if that gets fired.

SO this will help you to identify the problem and solve that. SInce F5 is working, I am not suggesting other KeyPress Event related issues.

:) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Thanks for your response, Ramani. Actually, the nkeycode value of f5 is -4. The KEYPRESS event does not even fire if F10 is pressed. I will keep looking for something in the code that is trapping that key, but I don't think it's in MY code (maybe somewhere in the framework). I'll post the answer if it's in the framework.
 
The F10 key has a default Windows behavior of accessing the menus. You can see this behavior right now if you like. The Keypress event will not even SEE an F10 keypress if the menu is visible.

There are only two ways around this that I know of.

1) You can issue an ON KEY LABEL F10 command to redefine its behavior.

2) If you have a MODAL form, you can hide the menu with SET SYSMENU OFF. If the menu is not visible, the KEYPRESS event will fire on F10.

Hope that helps,

Ian
 
Thanks, Ian. I was able to override the F10 key with the ON KEY LABEL F10 command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top