Menu items added that I don't want?

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?

Auto Fill
Start Dictation
Emoji & Symbols

Give us more information. OS, version, Xojo version, some screenshots showing the problem…

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.

Why do you WANT to remove them? Start Dictation, for example, is a vital part of the Mac’s ability to accommodate disabled users.

1 Like

Not tested, just adapted from an old code:

Try to call this from the App.Opening() event:

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
1 Like

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”.

1 Like

Thanks Scott - that worked!

1 Like