How to Use a KeyPress Event in Lieu of ON KEY LABELLast reviewed: December 19, 1995Article ID: Q140296 |
The information in this article applies to:
SUMMARYMany developers use ON KEY LABEL to assign programs or procedures within programs that are to be executed upon pressing a specific key (usually a function key). However, if the ON KEY LABEL assignment is to be specific to a control within a form, a better alternative would be to use the KeyPress event of that control.
MORE INFORMATIONThe KeyPress event is available for the following form controls:
CheckBox, ComboBox, CommandButton, EditBox, Form, ListBox, OptionButton, Spinner, TextBoxIt is possible to use this event to check for the press of a specific key. When using the KeyPress event to perform an action based on a function key, the function key's value should be used as shown in this table:
Key Alone Shift Ctrl Alt ------------------------------------ F1 28 84 94 104 F2 -1 85 95 105 F3 -2 86 96 106 F4 -3 87 97 107 F5 -4 88 98 108 F6 -5 89 99 109 F7 -6 90 100 110 F8 -7 91 101 111 F9 -8 92 102 112 F10 -9 93 103 113 F11 133 135 137 139 F12 134 136 138 140For more information on key values, refer to the INKEY() function in Visual FoxPro Help file.
Step-by-Step ExampleThe following steps show how to use the KeyPress event.
|
Additional reference words: 3.00 VFoxWin
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |