Microsoft KB Archive/164372

= FIX: More Than One Keyboard Letter Will Activate Some Hot Keys =

Article ID: 164372

Article Last Modified on 10/15/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition

-



This article was previously published under Q164372



SYMPTOMS
When assigning hot keys to the command button, check box, or option button objects, some keys trigger that hot key besides the letter key that was assigned to it. When assigning the letters G, O, R, or S as hot keys, pressing the Insert, Delete, Home, or End keys also triggers the objects that these letters are assigned to. Also, using the hot key letters A, B, and C can be triggered by the F7, F8, and F9 keys.



RESOLUTION
To work around this problem, use the ON KEY LABEL command to turn off these keys. Be careful using this method since it might cause problems in some instances because the Insert, Delete, Home, or End keys may not be available for things like editing data. The syntax for this command is ON KEY LABEL *. Note that the asterisk is what disables the key. To turn the key back on, issue ON KEY LABEL without the asterisk. Look in the "Steps to Reproduce Behavior" section for examples of using this command in a form.



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0a.



MORE INFORMATION
To allow an object to have hot key capability, place the "\<" symbols in front of the letter that is to be used as the hot key. For example, placing "\ Create a form and add seven command buttons to it. In the Caption property of each command button add the following:

Button 1: \ Run the form and press the Insert, Delete, Home, End, F7, F8, and F9 keys. Note that after pressing each key, the focus is set to the corresponding button.  To fix the problem, close the form and add the following code to the Init event of the form: ON KEY LABEL INS * ON KEY LABEL DEL * ON KEY LABEL HOME * ON KEY LABEL END * ON KEY LABEL F7 * ON KEY LABEL F8 * ON KEY LABEL F9 *   If you want to return the keys to their default functionality, add the following code to the Destroy event of the form: ON KEY LABEL INS ON KEY LABEL DEL ON KEY LABEL HOME ON KEY LABEL END ON KEY LABEL F7     ON KEY LABEL F8      ON KEY LABEL F9                        </ol>

<div class="references_section">