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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove or release any menu bar at run time 1

Status
Not open for further replies.

Rajesh Karunakaran

Programmer
Sep 29, 2016
549
MU
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.

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

[tt]SET SYSMENU OFF[/tt]

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

To re-enable the native menu, do this:

[tt]SET SYSMENU TO DEFAULT[/tt]

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

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
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!

Rajesh
 
(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.

 
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

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
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

 
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.
Rajesh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top