BlackTie
BlackTie

Reputation: 17

Foxpro Keyboard command

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?

Upvotes: 0

Views: 3560

Answers (4)

Zaheer Nazir
Zaheer Nazir

Reputation: 11

Perfect but not safer

On Key Label F5 _Screen.ActiveForm.cmdnew.Click

Perfect but Safe

Load Event -- Main Form This.KeyPreview= .T.

KeyPress Event -- main form

LPARAMETERS nKeyCode, nShiftAltCtrl
If m.nKeyCode = -4 && F5
   Nodefault
   Thisform.cmdNew.Click()
Endif

Other Trick

Public oMyGVar

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

Upvotes: 0

DRapp
DRapp

Reputation: 48139

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 {F1} will properly call the function or object.function.

Upvotes: 1

Rick Schummer
Rick Schummer

Reputation: 1067

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

Upvotes: 0

DaveB
DaveB

Reputation: 9530

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.

Upvotes: 1

Related Questions