Microsoft KB Archive/100812

{| = BUG: Mouse Click Causes Problems with MENU TO Command =
 * width="100%"|

ID: Q100812

The information in this article applies to:


 * Microsoft FoxPro for Windows, version 2.5

SYMPTOMS
Clicking the mouse anywhere other than on the prompts that are displayed when a menu is created with the @...PROMPT and MENU TO commands will cause FoxPro to endlessly cycle through all the displayed prompts. The only way to exit this cycle is to press ESC to cancel the program or to click a quit prompt. The mouse will not cause problems when a prompt is clicked on. The mouse will also function while in the endless cycle if a prompt is clicked. However, the keyboard will be disabled while in the endless cycle. You can sometimes use ON KEY LABEL assignments to break out of the endless cycle.

RESOLUTION
FoxPro for Windows offers several alternative ways to create menus similar to popup menus. These methods should be used if the MENU TO and @... PROMPT method causes problems. Using the Menu Builder or using push buttons are two alternatives.

STATUS
Microsoft has confirmed this to be a problem in FoxPro 2.5 for Windows. This problem was corrected in FoxPro 2.5a for Windows.

MORE INFORMATION
The MENU TO command is used to activate menu popups created with @...PROMPT. It is an old command that is included in FoxPro for backward compatibility with FoxBASE+. FoxBASE+ programs that are converted to FoxPro for Windows may contain menu popups that are created with these commands. These menu popups will work properly if only the keyboard is used to choose the menu items or if the mouse is clicked only on the actual prompts.

Steps to Reproduce Problem
The following sample program can be used to illustrate the problem:

ON KEY LABEL F12 WAIT WINDOW "Hello"   && This may stop the cycle. ON KEY LABEL F9 CANCEL             && This may cancel the program.

CLEAR

DEFINE WINDOW test AT 0,0 SIZE 25,100 ACTIVATE WINDOW test

PRIVATE menuch STORE 0 TO menuch

PRIVATE xx  STORE .T. TO xx   DO WHILE xx      CLEAR DO menus @ 12,26 PROMPT " 1" @ 13,26 PROMPT " 2" @ 14,26 PROMPT " 3" @ 15,26 PROMPT " 4"

MENU TO menuch

IF menuch = 4 CLEAR ALL CANCEL ENDIF ENDDO

RETURN

PROCEDURE menus

@ 12,18 SAY "          Not connected               " @ 13,18 SAY "          Not connected               " @ 14,18 SAY "          Not connected               " @ 15,18 SAY "          Quit the Application        " @ 18,18 SAY "   Please select the desired choice   " @ 19,18 SAY "      Press  when ready       " @ 20,18 SAY "   F9 Cancels the program also        " RETURN