Different ON BAR Behavior in FoxPro for MS-DOS & WindowsLast reviewed: June 27, 1995Article ID: Q115114 |
The information in this article applies to:
- Microsoft FoxPro for Windows, version 2.6 - Microsoft FoxPro for MS-DOS, version 2.6
SUMMARYThe ON BAR command has been enhanced in FoxPro version 2.6 to ensure compatibility with other xBase languages. However, the behavior of this command differs between FoxPro for MS-DOS and FoxPro for Windows.
MORE INFORMATIONIn versions 2.0 and 2.5 of FoxPro, the ON BAR command is used only to activate a second popup when a menu bar is chosen. In version 2.6, this command has been enhanced to execute a procedure upon movement to a menu bar. A new command, ON EXIT BAR, has been added to execute a procedure upon movement from a menu bar. In FoxPro for MS-DOS, the ON BAR command will work with the system menu, _MSYSMENU, or a user-defined menu. In FoxPro for Windows, the ON BAR command will work only with a user-defined menu. The ON BAR command will be ignored in FoxPro for Windows if it is used with the system menu. This behavior is by design. When you are using _MSYSMENU in FoxPro for Windows, Windows is in control of the menu, instead of FoxPro. Altering the behavior of the system menu could cause adverse consequences, including crashing Windows entirely.
Steps to Reproduce BehaviorThe following code example illustrates the different behavior of ON BAR when it is run in FoxPro for Windows and FoxPro for MS-DOS. To quit the program, press F8.
* Begin Code Example ON KEY LABEL f8 DO getout *********************************************** * Redefine system menu to use an ON BAR routine *********************************************** SET SYSMENU TO DEFINE PAD p1 OF _msysmenu PROMPT "p1" ON PAD p1 OF _msysmenu ACTIVATE POPUP pp1 DEFINE POPUP pp1 DEFINE BAR 1 OF pp1 PROMPT "b1" DEFINE BAR 2 OF pp1 PROMPT "b2" ON BAR 1 OF pp1 WAIT WINDOW "on bar 1 of system menu" ON BAR 2 OF pp1 WAIT WINDOW "on bar 2 of system menu" ON EXIT BAR 1 OF pp1 WAIT WINDOW "on exit bar 1 in sysmenu" ON EXIT BAR 2 OF pp1 WAIT WINDOW "on exit bar 2 in sysmenu" WAIT WINDOW "Now using ON BAR in _MSYSMENU" ACTIVATE MENU _msysmenu ***************************************************** * Define a user-defined menu to use an ON BAR routine ***************************************************** SET SYSMENU TO DEFAULT DEFINE MENU main DEFINE PAD p1 OF main PROMPT "p1" ON PAD p1 OF main ACTIVATE POPUP pp1 DEFINE POPUP pp1 DEFINE BAR 1 OF pp1 PROMPT "b1 of user menu" DEFINE BAR 2 OF pp1 PROMPT "b2 of user menu" ON BAR 1 OF pp1 WAIT WINDOW "on bar 1" ON BAR 2 OF pp1 WAIT WINDOW "on bar 2" ON EXIT BAR 1 OF pp1 WAIT WINDOW "on exit bar 1 in user menu" ON EXIT BAR 2 OF pp1 WAIT WINDOW "on exit bar 2 in user menu" WAIT WINDOW "Now using ON BAR in user defined menu" ACTIVATE MENU main ************************************************** * Procedure to cancel menu using F8 key ************************************************** PROCEDURE getout DEACTIVATE MENU main ACTIVATE MENU _msysmenu * End Code ExampleNote that the cursor does not highlight a menu bar until the ON BAR command has been executed. Likewise, the cursor does not highlight the next menu bar until the ON EXIT BAR command has been executed.
|
Additional reference words: FoxDos FoxWin 2.60
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |