次の方法で共有


KeyPreview Property

Specifies whether a form's KeyPress event intercepts the KeyPress events of a control. Available at design time and run time.

Object.KeyPreview[ = lExpr]

Return Value

  • lExpr
    The settings for the KeyPreview property are:

    Setting

    Description

    True (.T.)

    The form receives KeyPress events first and then the active control receives KeyPress events.

    False (.F.)

    (Default) The active control receives Keypress events; the form doesn't.

Remarks

Applies To: Form Object | Page Object | _SCREEN System Variable | ToolBar Object

The KeyPreview property is used to allow the form to handle KeyPress events before the active control processes them.

You can use this property to create a keyboard-handling procedure for a form. For example, when an application uses function keys, you can process the keystrokes at the form level rather than writing code for each control that can receive keystroke events.

If a form has no visible and enabled controls, it automatically receives all keyboard events.

See Also

Reference

Enabled Property (Visual FoxPro)

KeyPress Event

Visible Property (Visual FoxPro)

Other Resources

Properties (Visual FoxPro)

Language Reference (Visual FoxPro)