Adding a symbol in menuItems for minimized windows

Those menus do not exist in Xojo, so it knows nothing about them. If you want them gone you would have to use an API to do it. That said why bother to remove them. They work as required automatically without you doing anything. Why remove expected Apple functionality?

As for windowMinimise / maximise etc. I have those in my menu. As long as you get the text of the name correct it seems to use the menu that is already there, and seemingly (I’m my case anyway) leave them where they were. Apple have guidelines for the order of items on the Window menu and I suspect it is following those.

No, it still goes on the Window menu, but is apart from the list of Windows at the bottom of the menu. Look at Apple mail. It has an item “Message Viewer”, which is the same as you are describing it does not sit in the list of “current windows”, but above. The actual window still shows at the bottom.

The thing I found is that not having a separator on the Window menu, in the Xojo editor, allowed it to add its own. In my case the last item on the menu was “Bring All to Front”, which is typical for all the Apple apps I’ve seen. Perhaps that makes the difference?

And I think this is not great. We end up having a mix of some windows listed at the bottom (the existing windows) and some mentioned above (because they may be closed but the menu item should stay). Once a given window has been shown by choosing an “above” menu item, the user would find disconcerting that this given window isn’t in the very same list than the other windows (the bottom one).

Also, what if I’d like a specific menu item for a window, listed automatically in the bottom location, to have a fixed shortcut? (like, for the main window, Command-I)

Could be :man_shrugging:.
I’ll test, once I get time.

This is Apple, they seem to think this is the answer, so you are unlikely to get that changed. If you want that you would likely have to take over full control of the Window menu yourself.

Which goes back to wondering: “is it worth to make a Window menu?”.

I use it all the time, so for me certainly. I think users also expect it to exist.

Because you’re giving control of the Window menu to the macOS it is going to do with it what it pleases. These additional items get added to every application that lets the macOS manage the menu (As far as I know).

My guess would be, that while we design the UI in the Xojo IDE it does NOT use Apple’s nib files to recreate the UI, instead it rebuilds it at run time. Which is not what Apple expects, leading to menu item being out of order.

No. As I said, I looked into Apple Developer but I can’t find such names.

Anyway, from various screenshots in this post, I just realized that the Minimize and Zoom menus now are placed below the Tile Window to Left and Right of the Screen.
So I stop fretting about it.

As I said in my previous post, from several screenshots and even in AppleWrapper, I just now realized that Minimize and Zoom are no more at the top of the WindowMenu.
For BigSur users this will look a bit funny, since Mail and Safari still place them at the top.
Therefore I’m satisfied and I’ll mark Sam’s code as the solution to my question.
Thank you Sam, and to all who contributed.

Code to be put in the Open event of App:
#if TargetMacOS
declare Function NSClassFromString lib “Foundation” ( className as CFStringRef ) as integer
declare Function NSMenuitem_Submenu lib “AppKit” selector “submenu” ( NSMenuitemInstance as integer ) as integer
declare Sub NSApplication_setWindowsMenu lib “AppKit” selector “setWindowsMenu:” ( NSApplicationInstance as integer, inNSMenuitem as integer )
declare function NSApplication_sharedApplication lib “AppKit” selector “sharedApplication” ( NSApplicationClass as integer ) as integer

Dim subMenuRef as integer = NSMenuitem_Submenu( windowMenu.handle( menuitem.handleType.CocoaNSMenuItem ) )
NSApplication_setWindowsMenu( NSApplication_sharedApplication( NSClassFromString( "NSApplication" ) ), subMenuRef )
#endif

For more info, this is Sam's link:
https://ohanaware.com/blog/202127/Letting-the-macOS-manage-your-Window-menu.html

Yes, that’s undestandable.

I’m too below in the developer-ladder to understand all these intricacies, but thanks to the forum I get a lot of help.