Mac: menus don't hide when window does

BlitzMax Forums/MaxGUI Module/Mac: menus don't hide when window does

ima747(Posted 2010) [#1]
I'm playing around with some program structures, one of which causes one window to open another, hiding itself in the process, and then then the other window closes the first window shows and resumes it's event loop again. The problem is on mac that since both windows have menus, the menus just add together, so I end up with my menus being File Edit File Edit, seems to me that if the window which the menus are attached to is hidden the menus should hide as well... the old window menus are function in the new windows I in the mean time I will just be checking on mac if the menus already exist and then not making them, but this seems structurally wrong (from a cross platform standpoint), even though it makes sense from a mac layout standpoint (1 menu bar, 1 set of menus).

There also doesn't seem to be a good way to free/clear the menus on mass, I would have to keep each menu for each window in a variable, and free them when the window is hidden, then re-create when the window is shown again... or maybe the menus can be hidden as well, but still, for cross platform they should be codeable in the same way on mac and windows...


DrDeath(Posted 2010) [#2]
Well, first of all, it's very bad style on Macs to have different menus for different windows of the same program. The guys who wrote Apple's Human Interface Guidelines put a lot of thought into it and there are good reasons to follow these guidelines.

Secondly, when you really insist on having different menus for different windows (but you shouldn't), you will have to rebuild the menu every time you switch the windows. So, you have to check whether the windows is hidden or not, and when it's visible, clear the menu and define it again.

Anyway, I can't stress it enough: don't do this. Not on Macs and preferably also not on Windows and not on Linux. You'll only make things confusing for the user.


ima747(Posted 2010) [#3]
I'm rebuilding the same menus for every window for the purpose of having menus in those windows on *shudder* windows. My goal is not different menus (in fact it's the same menus) but rather less os specific code on cross platform development. Seems odd that the menus need to be attached to a window at all on Mac since it has no relation to it really...

It's a cross platform code design thing, not a human interface thing in this respect.


DrDeath(Posted 2010) [#4]
Okay, I see.

Seems odd that the menus need to be attached to a window at all on Mac since it has no relation to it really...

I guess that's also a cross-platform thing: since BlitzMax originates from Windows, I think they went the Windows way and attached the menus to the windows internally.