I have an app where I can launch a separate Help window from the main window. The Help window has a different menubar associated with it (done in the IDE) than does the main window. The main window has the default menubar named, as typical, MenuBar1. The menubar for the Help window is named HelpMenuBar. There are no duplicate names between the MenuBars. Both windows have an EnableMenuItems event handlers.
My assumption is that if, within one window, I were to call the EnableMenuItems event handler, it would run the one in the particular window and operate on the Menubar associated with that window. But what I’m seeing if I step through the code is that even when I call EnableMenuItems in the Help window, it winds up running the one on the main window (which doesn’t help me).
Is there a way to get it to execute the “local” EnableMenuItems? For that matter, shouldn’t it run the one local to the window? Or is there another way to manipulate the Enabled state of a Menubar in a separate window?
Edit: Sorry, I forgot to add that I’m running 2019r1.1 on Windows 10 for this project.
EnableMenuItems calls them on all windows, and even App.
Just out of curiosity, why is it that you need to call EnableMenuItems at all in your app? Ive only seen rare cases of this being needed.
I routinely use different menu bars in windows, but I assign them in the IDE. I then have no need to enableMenuItems.
Both of the MenuBars are assigned in the IDE, as are the MenuItems. I have certain MenuItems that are relevant only under certain conditions. Similar to the Edit menu items, I want to disable those particular items when not needed and re-enable them appropriately. In the past, I put the .Enabled=True and .Enabled= False statements (along with the appropriate conditional statements) in the EnableMenuItems handler. This works if I only have the one MenuBar.
So, if not by calling EnableMenuItems, how else can I get the state of the menuitem to change only for the window intended? Just setting the Enabled state doesn’t seem to update the actual menu.
Ok, I think I solved it. What I had to do is move the EnableMenuItems handler to the App section and fully qualify all the references outside of the App section itself. It’s not as clean, in my opinion, as having each window deal with its own, but it seems to work.