Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Remove or release any menu bar at run time

Remove or release any menu bar at run time

Dear all,

I have the native menu system in one of my applications. I want to release all those bars of the menu system, which are under development, at run time. I know if I isolate the development version from the finished version, I can keep different menu system. But, just to avoid these copies, I want to keep only one source code location.

Is there anyway to identify the bars of the menu fall under a condition (say, for example, if I specify 'DEVP' in front of the menu prompt text) so that I can release them one by one at run time?

Thank you in advance.


RE: Remove or release any menu bar at run time

The easiest way to do this is to completely hide the native menu system, like this:


You can then display your own menu in the usual way.

To re-enable the native menu, do this:


To determine whether you are in the development environment or an EXE, check VERSION(2). If it is 0, you are running in an EXE and so should hide the native menu.


Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Remove or release any menu bar at run time

Dear Mike,

Than you for the quick response!

But, I think I did not explain the scenario well. It is not VFP native default menu. I used the VFP menu system but the PADS, BARS etc are of my own menu items. I build my menu from the menu builder (through 'MODIFY MENU...'). So, now, in the menu I have all the menu items including the ones whose associated modules are actually under development. I don't want to show such items to the end user. So, I am looking for some way to catch each such menu item and release it before it is shown to the end-user. For identifying such menu item, I can include some fixed work to the menu prompt, like 'DEVP' or 'NOTUSED' etc. However, is there a way to traverse through the entire menu system, catch each menu item, look for my key word and if found release the menu item through command like 'RELEASE bar <n> of REPORTS...'?

I hope what I am looking for is clear now.

Thank you in advance dear team!


RE: Remove or release any menu bar at run time

(Almost) Every object does not instantiate, if you RETURN .F. from its Init(). So when you can find about a flag or name part, this is not productive, that's your switch to either return .F. or .T., for example in all buttons f toolbars. In menu items you perhaps want to apply a SKIP FOR _vfp.StartMode>0 to those items you want to not even have inactively shown at runtime.

Bye, Olaf.

RE: Remove or release any menu bar at run time

Rajesh, thanks for the explanation. If I've understood it right, at development you want to be able to see all of the native menu options plus your own custom bars and pads. At run time (in a production environment), you want to see those same custom bars and pads, but not the native options.

If that's right, what I told you was partly correct.

In the menu builder, create your own menu from scratch, with none of the native bars or pads. Generate an MPR file, as say MYMENU.MPR.

In your start up code, check which environment you are running in (dev or production). If production, hide the native menu, as I described in my previous post. Then, in both environments, DO MYMENU.MPR.

I think that will give you what you want. If I have still misundersood, my apologies.


Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Remove or release any menu bar at run time

For conditionally removing menu items at run time, nothing beats Andrew Ross MacNeil's GENMENUX.

You just add a directive to a menu's comments, and the tool does the deed.

Genmenux download page

RE: Remove or release any menu bar at run time

Dear DanFreeMan,

This is a 'knowledge' for me!
I downloaded it and had a glance of the documentation!
It appears excellent! Will test it at the earliest.

Thank you very much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close