You Can Use ACTIVATE MENU _msysmenu Instead of Foundation READ

ID: Q129505

The information in this article applies to:

SUMMARY

Some developers don't want to use a Foundation READ because a Foundation READ uses one read level in FoxPro, which leaves only four read levels. This article shows how to create an interactive program without using a Foundation READ. However, it also has a draw back in that the menu is always selected when nothing else has the focus.

MORE INFORMATION

To accomplish a non-Foundation READ event loop:

1. Set up a main program that will have a DO WHILE loop in it as in the

   following example of a simple main program:

   MAIN.PRG
   m.done = .f.
   DO mymenu.mpr && This is your menu.
   DO WHILE .NOT. m.done
      ACTIVATE MENU _msysmenu
   ENDDO

2. Modify your menu to have an option that will get you out of the loop.
   For example, create a menu procedure that contains this command:

   m.done=.T.

Explanation of Code

The ACTIVATE MENU _msysmenu holds up the application by activating the menu. Control is not returned to the DO WHILE loop until a menu option is selected or the menu looses focus.

To exit the program and return control to FoxPro (returning to the command window or to quit in an executable), you need a menu option that has a procedure to set the variable m.done to true. This allows the program an exit from the DO WHILE loop.

This method of Keeping FoxPro interactive does not consume a read, however the menu is always being Activated, so it will be highlighted.

Additional reference words: FoxWin FoxDos FoxMac FoxUnix 2.60a KBCategory: kbprg kbcode KBSubcategory: FxprgGeneral

Last Reviewed: June 27, 1995