Post

Replies

Boosts

Views

Activity

How do I set a menu check mark at runtime?
How do I set tick/check marks at a menu item at runtime?Main menu -> Submenu -> ItemMy best shot is this code, which compiles OK: let mainMenu = NSApplication.shared.mainMenu! let subMenu = mainMenu.item(withTitle: "Main menu")?.menu let menuItem = subMenu?.item(withTitle: "Submenu")?.submenu menuItem?.item(withTitle: "Item")?.isEnabled = trueAny help for a novice is appreciated.I have the following, which toggles check marks at mouse clicks:sender.state = sender.state == NSControl.StateValue.on ? NSControl.StateValue.off : NSControl.StateValue.on
15
0
4.1k
Dec ’19