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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual FoxPro F2 and F10 function keys

Status
Not open for further replies.

kenith

Programmer
Aug 10, 2002
11
0
0
CA
Someone has to ask the dumb questions - might as well be me.

Using VFP 7, Professional.
Form has keypreview enabled.
Routine at keypress, form level.

do case
case nkeycode = -1
thisform.blab.blab
case nkeycode = -2 (works well)
thisform.blab.blab
case nkeycode = -9
thisform.blab.blab
case nkeycode = 134
thisform.blab.blab (works well)
endcase

Function keys -2 through -8 (F2 through F9 inclusive) show under the debugger. -1 (F2) and -9 (F10) do not trigger the key press event. (133 and 134, F11 and F12 also show correctly.)

Other combinations tried:
case fklabel(nkeycode)='F2'
case nkeycode = (-1)

These seem to have no effect, good or bad, because the event does not seem to fire.

I can make the routines work by assigning a macro literal to the 2 keys. I would prefer to use the proper codes if they can be made to come through.

Any help will be appreciated.
 

Why not use the ON KEY LABEL? Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
kenith,
I believe Windows traps F10 - it's the same as just the Alt key - it activates the menu, so VFP will never see it. As far as F2 goes, perhaps Mike's suggestion is the "problem" rather than the answer - do you have an ON KEY LABEL in effect for F2? Do a DISPLAY STATUS to see what OKLs may be in effect.

Rick
 
Thank you folks. Between your replies I was able to find "Microsoft Knowledge Base Article - 200266" The form contained an activex calendar control. I removed the calendar form and f2 and f10 showed up. I put the calendar back and followed the article and f2 and f10 now work properly. (Should have told you about the calendar.) Thanks for the help

Ken
 
Back to the drawing board. Followed the same procedure with an additional form, same configuration and problem, and the remedy did not cure the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top