How add a Window menu to an application?

Hi all,
How to add a standard Window menu?
Should I create the items, 1 by 1 in a classic way and add my code?
I heard that the menu could be managed automatically (Appreciated code)?
Thanks

Sam posted a blog article about this:

https://ohanaware.com/blog/202127/Letting-the-macOS-manage-your-Window-menu.html

1 Like

Ok, thanks. I have 3 more smalls questions:

  • How do I add a checkmark to a menu item?
  • and what code for the “place in dock” menu
  • How to add the SHIFT shortcut? (Zoom menu: Shift+CMD+M)
    Thanks

You need a pointer to the menu item, and then:

menuPtr.HasCheckMark = True

OK. Thanks

myItem.HasCheckMark = not MyItem.HasCheckMark

Hi @Sam_Rowlands
Why i have a Syntax error on this line?

Center a Window : Centering a Window - #2 by Sam_Rowlands

declare sub NSWindowCenter lib "AppKit" selector "center" ( NSWindowInstance as integer ) NSWindowCenter( me.handle )

I have been adding a Window menu to all my MAS apps, using simply the menu bar editor. KIS.