MenuBar Missing

I have a weird problem that I don’t know how to fix. Window 1 has a menubar assigned in the properties. Window 2 has a different menubar assigned in the properties. Window 3 has no menubar.

When I run the app, menubar1 displays with Window 1. When I switch the view to Window 2, menubar1 stills shows and not menubar2.
When I go from Window 2 to Window 3, menubar2 finally displays.

Here is another. When I go from Window1 to Window2 and then click a button that has a simple MsgBox, menubar2 then displays.

There is no MenuBarVisible = False anywhere.

I don’t know whats going on. Just wondering if there was a command to force the Menubar to display.

first off… what platform?
second… by “assigned in properties” you mean you selected it on the right panel for each window?

I was not able to reproduce this with Xojo 2018r2 on macOS 10.12.6

If that is your target, if your window has no menu it will show the app.menubar menu selected there.
https://documentation.xojo.com/index.php/MenuBar

[quote]On macOS, if a window does not have a MenuBar specified, then the window uses the MenuBar specified on Application.MenuBar.
On Windows and Linux, if a window does not have a MenuBar specified, then the window will display without a MenuBar even if one is specified in Application.MenuBar.[/quote]

[quote=407135:@Dave S]first off… what platform?
second… by “assigned in properties” you mean you selected it on the right panel for each window?[/quote]

Xojo 2018 R2 Mac macOS 10.11.6

Yes the properties are assigned on the right panel.

[quote=407136:@Alberto De Poo]I was not able to reproduce this with Xojo 2018r2 on macOS 10.12.6

If that is your target, if your window has no menu it will show the app.menubar menu selected there.
https://documentation.xojo.com/index.php/MenuBar[/quote]

App.menubar = none.

Window1 = menubar1

Window2 = menubar2

Window3 = none

When Window 3 is displayed from Window 2, menubar2 is displayed.

If you have a sample project that I can run on my mac, I would test it.

I did a simple test, 3 windows, 2 menubars, couple of buttons to open other window. As soon as the new window is shown, it has the correct menu.

Hi Alberto,

I have no doubt that it will work correctly with a simple project. My project is large and complicated with a lot going on when the window loads, so I’m sure it is something in my code that is making it screw up.

I was just wondering if there was a line of code to force the menubar to be visible. I did create a work around by setting up a Timer to fire once at a 1 Millisecond interval displaying a new window and immediately closing it again. That works in forcing the correct menubar to display. Its not pretty, but it works.

There is something else going on. Basically menus should be handled just as you stated.

So. James… might publish what you discovered about you app that caused the issue, so that future genereations can perhaps learn from or not fall in the same hole? :slight_smile:

Dave, I will post the cause as soon as I figure out what is causing the menubar not to display. I have quite a few Methods that run when the window is opened and a bunch of timers that fire at different times, so its kind of hard to see what is screwing things up.