We know that the normal VFP menu is displayed in the main screen (_screen), but if you want to use the top-level form to do the main interface of the software, _screen is to be blocked off. This creates a problem: _screen is gone, where should the software menu go? No, you can solve this problem with a menu that can only be called from the top-level form, and the call to this menu is in the Init event of the top-level form, not in the main program.
This example makes a system main menu MAIN.MPR that can be used only from the top-level table, and in the next lesson we'll give you an example of using the top-level form to make the software main interface and call this menu in the example. The menu includes the data manipulation and exit two-level menus, and the Data Manipulation menu item contains the browse data, add records, modify data, and delete data four subordinate menu items, as shown in the following figure:
For the use of the Menu Designer, refer to: The use of VFP menu, this menu calls the four forms in the previous example "look at the example of VFP: The record in the table to locate and find operations", "see the example of VFP: Add records to the datasheet and verify that the input data is legitimate", " Look at the case of VFP: The record in the data table to modify the "and" look at the case of VFP: Delete data tables in the record "has introduced, the specific production methods here no longer described. Here are the steps to make this menu a bit more general:
First, open the Menu designer, first set up two levels of menu item "Data operation" and "exit", in the Menu designer, "Data operations" in the corresponding "Results" column Select "submenu", "Exit" the corresponding "Results" column Select "Process", the following figure:
Second, in the above illustration, click the Edit button on the right side of exit, and enter the following procedure code:
Msg=messagebox ("Are you sure you want to exit this system?", 4+32+1024, "system hint")
if msg=6 close
database
quit
endif
Third, then click to select the Data Action menu item name, and click the Edit button on the right. Create a browse data, add record, modify data, and delete data four subordinate menu items for the Data Actions menu item, select commands in the results column of the four subordinate menu items, and in the results In the "Options" column to the right of the column, enter the following four commands, as shown in the following illustration:
The Do form locates and locates records in the table. Scx
The Do form adds records to the datasheet and verifies that the input data is legitimate. SCX
The Do form modifies the records in the datasheet. Scx
Do form deletes records from a datasheet. Scx
Four, with the Menu Designer open, click General Options under Display in the VFP menu, and in the General Options dialog box that appears, select the Top Level form check box and select the Replace Radio box, as shown in the following illustration:
To save the menu as MAIN.MNX, click the "Generate" command under "menu" in the VFP menu, and generate MAIN.MPR.
This example code is debugged in the win2003+vfp6.0 environment.
See the full set of "rookie also learn VFP" tutorial