The default menu that is added to a new project does not show the following menu items in the Edit menu; however, when you run the app in debug mode, it adds them. How can I keep these from being added to the Edit menu?
I think they’re stock items that are added by macOS. You could try adding ones with the same name and making them invisible? I don’t know if that would work.
Public Sub DisableExtraMacMenus()
#If TargetMacOS
Declare Function NSClassFromString lib "Cocoa" (ClsName As CFStringRef) As Ptr
Declare Function standard lib "Cocoa" selector "standardUserDefaults" (id As Ptr) As Ptr
Declare Sub setBool lib "Cocoa" selector "setBool:forKey:" (id As Ptr, b As boolean, k As CFStringRef)
Var userDefaults As Ptr = NSClassFromString("NSUserDefaults")
Var standardUserDefaults As Ptr = standard(userDefaults)
setBool(standardUserDefaults, true, "NSDisabledDictationMenuItem")
setBool(standardUserDefaults, true, "NSDisabledCharacterPaletteMenuItem")
#EndIf
End Sub
These are features added automatically by macOS, when the top menuItem has a text value of “Edit” (or &Edit).
If you rename the text value to something else, like “Editing” (or whatever), then those extra items don’t show up. Same goes for “View” or “Help”.