how to disable/hide emoji in menu bar

Hello folks,

I have a textbox in my app and I don’t want to user can input emoji into that. For some reason, I have to use key down event to catch all the keyboard input and I don’t want to add textchange event to make the mess. Is there any method to either hide the emoji input option in menu bar or can disable it completely from menu bar?

Thanks!

[quote=218517:@BO CHEN]Hello folks,

I have a textbox in my app and I don’t want to user can input emoji into that. For some reason, I have to use key down event to catch all the keyboard input and I don’t want to add textchange event to make the mess. Is there any method to either hide the emoji input option in menu bar or can disable it completely from menu bar?
[/quote]

Change the caption of the Edit menu from “&Edit” to "Edit " (with a trailing space). All the extra options like ‘Start Dictation’ and ‘Emojis and Symbols’ will no longer show.

Michels solution is nice and simple, but if you still want the Dictation item you can do this…

For your app running on new computers I think all you have to do is save the following text in a text file named “Info.plist” and drag that into your project.

[code]<?xml version="1.0" encoding="UTF-8"?>

NSDisabledCharacterPaletteMenuItem [/code]

That key and value (which hides the offending menutem) then gets added to your apps full Info.plist. The thing is on first run of your app that Info.plist gets copied into the computers Preferences folder and from then on it’s the Preferences data that’s used.

So on your computer I’m guessing this file is already present in Preferences so the added key/value is ignored. To get it updated, um, I don’t know how to nuke that Preferences file, but you can run this code instead. You only need to run it once and then on the next launch of your app the menuitem will not be there.

[code]Sub Action()
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)

dim ud As Ptr = NSClassFromString(“NSUserDefaults”)
dim s As Ptr = standard(ud)
setBool(s, true, “NSDisabledCharacterPaletteMenuItem”)

End Sub[/code]

I’m not familiar with this exact preference, but it might work without the restart if you put the code in the App’s constructor.

@Michel [quote]Change the caption of the Edit menu from “&Edit” to "Edit " (with a trailing space). All the extra options like ‘Start Dictation’ and ‘Emojis and Symbols’ will no longer show.[/quote]

Very good!
Is there an easy way to completely clear the default menuitems when building a contextualmenu for textareas?
At present my workaround is (in the constructContextualMenu handler of the field):
me.sellength = 0//lookUp, fonts etc. items wont show up
//now add custom menuitems