Microsoft KB Archive/137180

{| = How to Return to a Menu's Submenu After a Selection =
 * width="100%"|

ID: Q137180

2.5x 2.60 2.60a | 2.5x 2.60 2.60a | 2.5x 2.60a

WINDOWS        | MS-DOS          | MACINTOSH The information in this article applies to:
 * Microsoft FoxPro for Windows, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
 * Microsoft FoxPro for MS-DOS, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a
 * Microsoft FoxPro for Macintosh, versions 2.5, 2.5a, 2.5b, 2.6, 2.6a

SUMMARY
When a user makes a selection from a menu, the menu disappears and then the selection is executed. Some programmers want to have their users returned to the selected menu and submenu with the last choice highlighted. This article gives the steps you need to follow for every menu option you want to return to.

NOTE: If a menu is disabled at the time the ACTIVATE POPUP command is issued, it will not activate the last menu. This can occur when you create a Quick Menu and use the default menus supplied by FoxPro. FoxPro will automatically enable and disable menus depending on the current status and environment in FoxPro. For example, the Record menu is enabled only when a database file is open. Clicking an option on this menu runs a procedure that closes the database file in the current work area, the Record menu becomes disabled and the ACTIVATE POPUP command will not be able to redisplay the Record submenu.

Step-by-Step Procedure
1. Create a quick menu.

2. Insert a new menu option on the Edit menu, and set the Result to the

Procedure option. 3. In the procedure, enter these statements: PRIVATE lcLastPopup, lnLastBar

lcLastPopup = POPUP lnLastBar  = BAR

* place your statement(s) here that * will be executed for your menu option

ACTIVATE POPUP &lcLastPopUp BAR lnLastBar 4. Save the menu, and generate the menu code. 5. When you run the menu, the selected option will run, but when it is

completed, the menu and submenu will reappear, and the last option selected will be highlighted. NOTE: The above procedure calls the menu procedure recursively. If the procedure is performed more than 32 times, a "Do nesting too deep" error message may be displayed. Additional reference words: FoxWin FoxDos FoxMac 2.50 2.50a 2.50b 2.50c 2.60 2.60a Sticky KBCategory: KBSubcategory: FxprgGeneral

Keywords         : kbcode FxprgGeneral Version          : 2.5x 2.60 2.60a | 2.5x 2.60 2.60 Platform         : MACINTOSH MS-DOS WINDOWS
 * }