I'm a very old, retired, CCOBOL and ASSEMBLY programmer with some experience with dBase and FoxPro from the command window. A charity has asked me to get an old FoxPro for DOS program working on a donated used computer which contains VFP6.0. I have gone over the data files and they seem to be OK. The indexes have been converted to CDX type and that works. The old DOS program worked by relying on append and browse commands which all work. The needed reports were all hard coded with space() to fill lines nicely and they work.
The only thing that doesn't work is the old character screen menu. It had 10 @SAY and 10 @GET commands and a READ. Then it routed execution to .PRG files with a DO CASE ... ENDCASE loop. How do I generate a nice looking windows menu which responds to the mouse and hot keys using the menu generator (CREATE MENU). I can't figure out where the calls to the procedures (.PRGs) have to go into the properties of each menu pad or how to make a key hot. The help file is not much help. OOP is not something we used in the COBOL world.
Anybody got a good simple book that will tell me how to make a menu work.
Paul

How to upgrade a menu from FoxPro for DOS
Zoey Co
With a name like Jurgen Wondzinski I don't know whether to answer in German or Polish so I'll answer in English.
Your explanation is very clear! Why can't they write something like that in their help files! Even an old procedure oriented COBOL guy can follow that.
The data entry people at this charity have been using the DOS program since about 1987. It goes back to when Fox was in Maryland, or maybe even to dBase II. They don't need a Help pad on the menu. The stuff on the Edit menu is also not needed since they will do their searching from a browse window using Ctrl+F. The browse window will either be no update or will have restricted fields permitting them to edit only the stuff I want them to edit.
The Files menu pad is just plain confusing when you don't have any file selection ability in the program. So, how do I get my menu choices in pads on the top bar instead of in a drop down.menu. My choices are likely to be <ADD> <FIND ALPHA> <FIND NUMBER> <REPORT 1> <REPORT 2> <PACK & BACKUP> <EXIT>. I would like the hot keys to be A, L, U, 1, 2, B, X.
By the way, I don't believe in leaving data files open while the program is sitting at the menu, so they are opened and the index is selected programmatically. There will be no cleanup work to do upon leaving the menu.
Paul
M.KhoshZaban
You may have some looping construct wrapped around the old DOS menu, so that the user circles around in that menu until he breaks out of it. This can get removed completely, the "circling" is now done inside the READ EVENTS line. The breakout is the "Clear events" line of the menu.
Usually all setup and initialisation code goes in the top of your start program, then follows the menu definition, and the very last line is the READ EVENTS line. The execution flow stops at that line, circeling at that line until the user wants to quit the app. After that Read Events there should be only some cleanup code like
CLOSE ALL
CLEAR ALL
RETURN
Maor
Paul
Gerfboy
http://msdn.microsoft.com/library/default.asp url=/library/en-us/dv_foxhelp9/html/737fa94e-e1a7-4f98-a6bb-2a33e15ca729.asp
ybnormal
Hi Paul, if you start the menu designer in VFP, at the very first choose the option "Quick Menu" from the menu-designers menu.
It will then populate the empty designer with the original VFP6 system menu entries. Now you just delete all the stuff you don't need, since deleting is always easier than typing all the needed parts ;) . For example, you will want to keep at least the File, Edit, Window and Help pads, but get rid of View, Tools and Program pads.
In the File pad, you now replace the "New" entry with Prompt = "My first Menuoption", Result = "Command" and the next field (Command) gets the "DO Option1.PRG" code.
The "Options" button on the right side opens a new window where you enter additional info for that menu-option. For starters you could leave them all blank.
Then add/change as many menu entries as you need, and then finally delete all the unneeded entries in the file-popup definitions. The last one ("exit") also gets changed to Result = "command" and the code to "CLEAR EVENTS".
The EDIT menupad is completely ready to go, don't change anything in there.
The WINDOW menu needs a little bit deleting: kill the HIDE / SHOW entries as well as the last three (developer related) entries.
Similar is the HELP menu: Reduce it to one option: Prompt = "Help", Result = "command", command = "HELP".
If you want to get fancy, you could also add a "About" entry, wich would also be a Result = "command", command = " DO FORM ABOUT.SCX". Then you could play with the VFP Formdesigner, create a About.scx form, set the properties WindowType =1 and AutoCenter = .T. and add as much controls as you like. This would then be your first OO-Form in that application!
After you edited the menu definitions, you close the designer and save it with some useful name (like "startmenu.mnx").
In your start.prg, you now remove the part with the dos based menu, and replace it with:
DO Startmenu.MPR
READ EVENTS
That *.MPR (= Menu PRogram) isn't on your disk initially, it gets automatically created when you run the Project-Managers Build... process. But you can also use the menu-designers menu-option "Generate..." to generate the "startmenu.MPR" from the definition file (MNX).
There's also a lot of information in the helpfile about menus etc.
billy-boy
'\<ADD', 'FIND \<ALPHA', etc
These will only work, however, after selecting the ALT key when your app is working.
Draxinmus
The only problems left are as follows:
1. When I drop out of the program back to the command window my menu is still there. How do I get the standard foxprop menu to resurect itself
2. The standard foxpro toolbar remains on the screen whenever my program is running which will be very confusing to the non-tech end users of this database. How do I get rid of it
Paul Lepkowski
mrsmithsp1
Hi Paul,
don't try to mimic the old DOS menus; this is now a Windows app, and should follow the established User interface.
You really shouldkeep the EDIT Menu because it is essential for VFP. All editing shortcuts (like Ctrl+C / Ctrl+V) in textboxes etc are done with this menu. No Editmenu: no shortcuts: no functionality!
josh55
Now the only problem I have is the View menu. I left the View submenu in the generated menu, but when the program calls a browse window the usual Browse Menu you get from the command window with the selection under View to change from Browse to Edit, (horizontal to vertical orientation of fields) does not appear. The View submenu seems to change a lot from the command window, it just shows [Toolbar] until you USE a data file, then it shows [Browse, Table Designer, Toolbar], then when you command BROWSE it shows [Browse, Edit, Append, Table Designer, Grid Lines, Toolbars].
How do I get the program's menu to include [View - Browse, Edit] but not [View - Append, Table Designer, Grid Lines, Toolbars] during program execution
Paul
GaetanoDiGregorio
This will revert the default VFP system menu or the menu you saved with:
SET SYSMENU SAVE
I have a developer menu pad I add to the standard VFP menu so I save the menu in my startup program. Now when I exit my program I revert the menu or if my programs crash all I have to do in the Command Window is set it back to the default and I get my enhanced menu, not the standard one.2. You need the following commands to work with the toolbar:
HIDE WINDOW
standardSHOW WINDOW standard