Window frame (floating) and menubar (Mac Only)

This may be a question on window frame attributes.
If I have a project with multiple windows, and AWindow is a document frame, and BWindow is a floating window that is called by AWindow, then what happens to the menubars associated with each window?
For some reason BWindow’s menu items are not being called, and AWindow’s are being called instead. Is this appropriate?
If this is true, how can I mimic a floating window?
Or how can have a sub window with its own menubar?

Have you set the MenuBar property for the floating window in the window designer?

Yes. It has its a different menubar.
I also added a line to the window’s open event after discovering problems

Self.MenuBar = MenuBarSm

It didn’t change a thing.

You have menuhandlers on AWindow and BWindow return true?

Thanks. Cheating got in my way.
Actually I think the menuitem calling the window doesn’t finish. Thanks. It had always confused me why the menus didn’t automagically change. I’ll have to do something else.

Move the code to a short-period timer. That will allow the menuhandlers to unwind.

Thanks Tim. I generally avoid more than simple timers.
Not sure how to do that effectively.
Do I put Booleans in it or is there a more elegant solution?

This is the simplest of timers. Short period (period=1 will work), single-shot. Simply move all your code except “return true” to the timer and replace it with a line of code to start the timer. The menu handler starts the timer and returns true. The timer executes the window code and stops.

I have an update. I finally decided to try this sub-window problem on my PC (not Mac) and the menubar shows up correctly.
I had moved all of the code after the call and it still showed as the main menubar. I then wondered if the subwindow was even window(0). (Yes I have return true at the end of the menuitem. The subwindow has frame set as document.)

Nope the calling window is 0.

I then ran the same code on my PC and the subwindow shows as 0

So it’s now a Mac and Mac menu problem. What do I do?

I quickly tested it on macOS. Two windows with each its won menu bar:

Window1.Menubar is set to Menubar1 in the window designer Window2.Menubar is set to Menubar2 in the window designer

I open Window2 from Window1 (via a Button oder a MenuItem):
– If Window2 is a DocumentWindow, then Menubar2 is shown and Window(0) is Window2.
– If Window2 is a FloatingWindow, then Menubar1 is shown and Window(0) is Window2.

IMHO this is the correct behavior.

Why must we do have to do that ?
I forgot once in a while… :frowning:

This is a definite problem. The main window gets closed first.

For clarification, I re-explained the problem.

This is only a Mac (versus Windows) problem.
This is also document frame versus Other frames like floating frame problem.

I have a child window (Ch) that is opened by the parent window (Pa).

Both menubars are called out in the Layout and in their event Open.
This Ch window has its own menubar (that’s used for all small windows):
Self.MenuBar = MenuBarSm

This Pa window has the all menubar.
Self.MenuBar = MenuBarAll

If the child window Ch is a document (frame property) window then the menubar MenuBarSm gets activated and it is also window(0). If not a document frame then any menu operations are on the parent window Pa and not Ch. This becomes a problem if I attempt to close the top window Ch via menukeys Command-W.

Other event operations like Activate are from Pa.

Is this normal?
What could be going wrong that Pa is Window(0)?

That is the correct behaviour on macOS for a floating window.

Not here, if the child window is in front, then it is Window(0).

Thank you. Ca or the child window is in front and is NOT window(0). So it’s definitely not expected.