How to Highlight a Menu Option or Menu Item ProgrammaticallyID: Q143074 3.00 3.00b WINDOWS
The information in this article applies to:
SUMMARYUpon startup of an application, you may want to have a specific menu or menu option highlighted by default so that the user need only press the ENTER key to carry out the associated command. This article presents a simple way to do it.
MORE INFORMATIONThis method, which depends on the KEYBOARD command, can be used with either FoxPro for Windows or Visual FoxPro. 1. Create a program, name it MAINMENU, and put the following code in it:
2. Create another program, name it CALLMENU, and put the following code in
3. Create a new menu named testmenu, and give it the following structure
4. In Visual FoxPro, on the View menu, choose General Options, and select
5. In the Cleanup code, type:
6. Save and generate the menu.
7. Create a new form, name it FORM2, and place a command button on it. Put 8. Run the MAINMENU program.
This should cause the menu prompt 'Form 2' to be highlighted. Pressing the ENTER runs the form, and clicking the command button closes the form and cycles the menu back to the 'Form 2' prompt. This method can be called an unlimited number of times without running into the 'Do nesting too deep' error message you may encounter if you use the ACTIVATE MENU command. The other significant advantage is that the use of the KEYBOARD command allows you to drill down to a specific menu option (in this case, Form 2). The disadvantage to this method is that there is a flicker as the keyboard commands are executed. For information about how to do this with FoxPro 2.x, please see the following article in the Microsoft Knowledge Base:
Additional reference words: 3.00 3.00b VFoxWin bar
KBCategory: kbhowto
KBSubcategory: FxprgGeneral
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |