Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System Menu Names 1

Status
Not open for further replies.

academica

Technical User
Feb 21, 2010
28
CN
I want to quickly add a simple menu to my project (File, New, Open, Close, Exit). I copied the two files ..\Coverage\Demos\demo.mn? to my project. Run! But the bars Open and Exit are disabled. I expected that _mfi_new, _mfi_open, etc. will start their corresponding procedures. The help says 'With these names you can use the Visual FoxPro system menu bar to create a menu system for your own application.'

What's wrong? Where can I find a simple menu code?

Note: I'm new to VFP and my questions are far too basic, probably not suitable for this forum. is there a forum for beginners in VFP?

I will appreciate your consideration and understanding.

VFP 9.0 SP2 on XP SP3
 
First, here is fine for your questions.

To create your own menu, open the Menu Designer (either using the menu or by issuing CREATE MENU in the Command Window). Then, choose Menu (not Shortcut) from the dialog that appears. Then, choose Menu | Quick Menu from the menu.

That'll give you a duplicate of the VFP menu to start with. You can then delete what you don't need and add what you do.

To use your new menu, save it, then choose Menu | Generate to create the actual menu code. To run it, issue DO <Your Menu Name>.MPR.

Tamar
 
Tamar, a big THANK YOU for your reply.

I tried this procedure and I still could not make the menu work as I expected. I guess for each menu option I should replace Result with Procedure and write my own code to open and close file, etc. But it's only guesswork I have to rely on, I'm afraid.

Here is my general impression of VFP 9: one cannot START from here without previous experience with the Visual component of XBase.

I have the feeling that Microsoft deliberately refrain from explaining things in a simple and friendly way and it's their corporate trend (or due to self-conceitedness). Free software has perfect support and documentation and paid software is so unfriendly! How come?

Users and fans of XBase like me badly need a comprehensive Bible on Visual FoxPro, because it's a very very good DBMS, RAD platform and programming language left without any support like an orphan child. I am sure that a good comprehensive and friendly guide will increase the number of FoxPro users. Not by Microsoft, for sure. I hope Hentzenwerke will think about it.

VFP 9.0 SP2 on XP SP3
 
I guess for each menu option I should replace Result with Procedure and write my own code to open and close file, etc.

In general, that's true. Personally, I prefer to set the result to Command rather than Procedure. In the Command field, I place a call to a function that does whatever I want the menu option to do. The function itself is coded in a separate PRG file.

For example, if you have a menu option for opening your Customers table, you might do this:

1. Write a function called, say, OpenCustomers().

2. Place the function in a PRG file called, say, MyProcsPRG. To reference the PRG file, execute SET PROCEDURE TO MyProcs near the start of the application.

3. In the menu designer, create a menu option called, say, Open Customers. Set the result to Command. In the command box, enter OpenCustomers().

4. Save the menu. Generate the MPR file.

As an exception, for the standard Edit menu commands (Cut, Copy, Paste, etc), set the result to Bar #, and choose the appropriate bar in the resulting dialogue.

Up to a point, it's a matter of personal preference, but I find the above technique works well for me.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Thank you, Mike, for the posting. A good idea!

VFP 9.0 SP2 on XP SP3
 
Users and fans of XBase like me badly need a comprehensive Bible on Visual FoxPro, because it's a very very good DBMS, RAD platform and programming language left without any support like an orphan child. I am sure that a good comprehensive and friendly guide will increase the number of FoxPro users. Not by Microsoft, for sure. I hope Hentzenwerke will think about it.

There are already plenty of Hentzenwerke books that address your issues. For getting started, try "The Fundamentals" by Whil Hentzen:
A lot of people consider one the Hacker's Guide their "Bible" for the VFP language: (Disclaimer: I'm one of the authors.) If you get it, make sure to download the e-book version; that's where you'll find all the reference pieces.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top