tags:

views:

36

answers:

3

When I use the keyboard command it works in the foxpro debugging enviroment, but when I build the .exe the Keyboard command does not work. When I have the foxpro form in focus even pressing F1 nothing happens till I take focus off the running application?

Example

KEYBOARD "{F1}"

In debug non .exe mode works great, but in .exe mode does not do anything?

+1  A: 

I think this is by design. The help file is not part of the exe, it is part of the development environment. So, when running the application outside of the FoxPro development environment, the help file is not available.

DaveB
So is there a way to have the Keyboard command sent outside of the Foxpro.exe, to the general windows enviroment? Sounds like that is the issue I am having?
BlackTie
You can use the SendKeys method from the Windows Scripting Host. http://msdn.microsoft.com/en-us/library/8c6yea83(VS.85).aspx
DaveB
+1  A: 

Although @DaveB is correct by design for the F1 help subsystem, you can still circumvent and make the keypress work by tacking in the "ON KEY LABEL"... something like...

ON KEY LABEL F1 CallYourFunction()

But the "CallYourFunction" can't be reference any "This." or "Thisform.". However, if you have a global variable to some object you want the F1 to link to, you can do it that way too... such as

oMyGlobalVar = Thisform
ON KEY LABEL F1 oMyGlobalVar.SomeFunction()

then with your KEYBOARD {F!} will properly call the function or object.function.

DRapp
+1  A: 

Where do you have the KEYBOARD command? Is it in button Click() on a form, or some other method?

The KEYBOARD command stuffs the key into the keyboard buffer for Windows to process. DRapp offers up the ON KEY LABEL, which allows you to set up the functionality of the keystroke before a user clicks on the key.

But I am not sure exactly what you are trying to accomplish first.

Rick Schummer - VFP MVP

Rick Schummer