Menu bar does not change w new window

How can I get the menu bar to change when a new window is opened

i found the question was asked before with no answer,
no Menu bar

please advise

You have two ways.

One is to create several menu bars in your project and assign the one you want to each window (using its MenuBar property, at design/compile time).

The other is to hide/show menu or menu items in a window’s Activate event.

You can mix both ways.

im using OSX 2019 r 1.1

i already created and assigned multi menu bars to different windows, using the property

at open i hide one made the other visible no result.
the app wants to show the main win menu and does not change auto for new windows

Can you share a sample code using dropbox?
Is this with Windows or Mac?

sorry i dont know drop box
MAC OSX 10.11 and 10.15

The thing is that we may need to see your code to find a way to make it work.

I did a test, created 2 menus, 2 windows and it seems to work, or maybe you are talking about something different
menuchange.2021-08-19 16_42_26

If your JobsWin Window will always show your JobsMenuBar, you can set it:

And I think your JobsWinOpen code should be something like:

me.MenuBar = JobsMenuBar

if you don’t want to set a specific menu to a window and be able to assign one in the open event.

I tried this

Win Open Event
me.MenuBar = JobsMenuBar

the JobsMenuBar does not show upon win open

but after Jobwin opens, i click on mainwin, then i click on Jobwin then the jobmenbar does show
but a lot of clicking

It does rely on the window being frontmost. When showing and hiding Windows, make sure you are calling Show and not just setting Visible to True.

I had to put a one-shot timer on the form with this code in it:

if TargetMacOS then self.MenuBar = self.MenuBar

Then I copy/pasted that timer onto all of my other forms.

i always use Win.Show when opening windows

This code is used in every Window - a timer in each?
what is the timer.value = ms

Seth’s a Genesis

The timer works like a charm , cool

1 Like

What about using the Activate event?