ID: Q114185
2.5x 2.6x | 2.5x 2.6x | 2.5x 2.6x
WINDOWS | MS-DOS | MACINTOSH
kbtool kbprg
The information in this article applies to:
In the Screen Builder, hot keys (also known as access keys) can be assigned to push buttons. However, the Screen Builder does not provide a built-in process for assigning hot keys to other screen GET objects, such as fields, popups, list boxes, and so on.
The information below describes how to create hot keys for GET objects other than push buttons by using the ON KEY LABEL statement, the _CUROBJ system variable, and the OBJNUM() function.
NOTE: In Visual FoxPro for Windows, use the ActiveControl form property instead of _CUROBJ and OBJNUM().
1. Use the Line Drawing tool to simulate the underline of a character (the
underline font style is not supported in the Screen Builder). Select the
Line Drawing tool from the toolbox. Place a short line under the letter
in the field description that will be used in the hot key.
2. In the SETUP snippet of the screen, place an ON KEY LABEL <ALT+key>
_curobj = OBJNUM(object) command. This commmand instructs FoxPro to jump
to the object when the hot key is pressed.
3. Place a POP KEY command in the CLEANUP code of screen to clear the ON
KEY LABEL commands.
If you are using memory variables in conjunction with SCATTER and GATHER commands in the GET fields, remember to include the "m." (without the quotation marks) alias with the field names.
The POP KEY command clears all ON KEY LABEL settings. If you are using F1 for help, add another ON KEY LABEL command to reassign the F1 key. Similarly, restore any other needed ON KEY LABEL statements needed. (Alternatively, investigate using the PUSH KEY command in the SETUP snippet to store the original ON KEY LABEL assignments).
1. Assuming FoxPro is installed in a directory named FOXPROW on drive
C, type the following commands in the Command window:
USE C:\FOXPROW\TUTORIAL\CUSTOMER
CREATE SCREEN test
2. From the Screen menu, choose Quick Screen.
3. In the Quick Screen dialog box, choose Fields.
4. Move the CNO and COMPANY fields to the Selected Fields list box.
Choose OK twice to return to the Screen Design window.
5. Select the Line Drawing tool from the toolbox. Place a line under
the letter "C" of the text object "Cno," which is located to the
left of the GET field for CNO. (In FoxPro for MS-DOS, choose Box
from the Screen menu. Size the box so that it appears as a line.)
6. Select the Line Drawing tool again. Place a line under the letter
"o" of the text object "Company," which is located to the left of
the GET field for COMPANY. (In FoxPro for MS-DOS, choose Box from
the Screen menu. Size the box so that it appears as a line.)
7. From the Screen menu, choose Layout.
8. Under Options, choose Code. (In FoxPro for MS-DOS, do not select
anything--go directly to the next step.)
9. Under Screen Code and Clauses, choose Screen Setup Code, and then
choose Cleanup and Procedures. Choose OK twice. (In FoxPro for MS-
DOS, under Screen Code, choose Setup. Then choose Cleanup and
Procedures. Choose OK once.)
10. In the Setup snippet window, type the following:
ON KEY LABEL ALT+C _curobj = OBJNUM(CUSTOMER.CNO)
ON KEY LABEL ALT+O _curobj = OBJNUM(CUSTOMER.COMPANY)
11. Close the Setup snippet window, saving changes.
12. In the Cleanup snippet window, type the following:
POP KEY && Clear all ON KEY LABEL statements
ON KEY LABEL F1 HELP && Restore F1 to Help
13. Close the Setup snippet window, saving changes.
14. From the Program menu, choose Generate.
15. When prompted to save changes to the screen, choose Yes.
16. When prompted to save environment information, choose Yes.
17. In the Generate Screen dialog box, choose Generate.
18. Close the Screen Design window.
19. In the Command window, type "DO test.spr" (without the quotation
marks).
Press ALT+O. Note that this selects the COMPANY GET field. Now press
ALT+C. This selects the CNO GET field.
For additional information on creating hot keys in Visual FoxPro, please see the following article(s) in the Microsoft Knowledge Base:
ARTICLE-ID:Q128752
TITLE :How to Use Hot Keys in Visual FoxPro
Additional reference words: FoxMac FoxDos FoxWin 2.50 2.50a 2.50b 2.50c
2.60 2.60a hotkey hotkeys short cut shortcut
KBCategory: kbtool kbprg
KBSubcategory: FxtoolSbuilder
Keywords : FxtoolSbuilder
Version : 2.5x 2.6x | 2.5x 2.6x | 2.5x 2.6
Platform : MACINTOSH MS-DOS WINDOWS
Last Reviewed: May 1, 1996