Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9259305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:37:28+00:00 2026-06-18T12:37:28+00:00

for the last two days I’ve been searching and reading a lot about something

  • 0

for the last two days I’ve been searching and reading a lot about something that should be very simple. It has become clear that isn’t the case: I’m trying to make this:

Key Equivalent field in IB

That’s all. I know shortcut recorder is pretty old and I’ve been working with the Demo of MASShortcut. MASShortcut is pretty awesome, but it’s a lot of code for something so seemingly easy.

I’ve also searched in a lot of Apple sample code (hoping they would implement this somewhere other than Interface Builder, but no luck so far).

This leaves me with the following questions:

-Is there any documentation that could clarify some of this stuff? Or are there other, more simple solutions than MASShortcut?

-I’ve been trying to replicate something like the IB control myself, but I’m still stuck at “converting” the pressed keys to characters in the NSTextField (or is it a custom NSView in IB?). Does Apple offer an easy way to do this? Because catching everything with sendEvent and comparing it against a list of all keys seems a lot of work and I wonder how the apple programmers have done that in the control seen above. Should that be the only solution, are there different keyboard layouts I should be concerned about when I use it?

-How do other applications implement this so that it becomes visible here:
System Preferences > Keyboard

As you can see TextWranglers appears here, does that happen automatically when I call “[NSEvent addGlobalMonitorForEventsMatchingMask:]” in my application?

These are a lot of questions, I’m just hoping one of you guys can point me in the right direction.

Thanks in advance,
Frans

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:37:29+00:00Added an answer on June 18, 2026 at 12:37 pm

    I was fiddling around with getting characters from key presses myself last week, and I stumbled upon two functions that for some reason I hadn’t seen before: UCKeyTranslate() in CoreServices and the apparently related CGEventKeyboardGetUnicodeString() (looks like a wrapper of the former) in ApplicationServices.

    It seems like these are the functions — or at least go through to the code — that Apple’s own text system is using to translate key presses into Unicode strings for display as text.

    A simple examination of an NSEvent‘s modifierFlags should suffice for turning the modifier key state into a string like ⌥⇧⌘:

    NSUInteger flags = [theEvent modifierFlags];
    NSString * modString = [NSString stringWithFormat:@"%@%@%@%@",
                                    (flags & NSControlKeyMask) ? @"^" : @"",
                                    (flags & NSAlternateKeyMask) ? @"⌥" : @"",
                                    (flags & NSShiftKeyMask) ? @"⇧" : @"",
                                    (flags & NSCommandKeyMask) ? @"⌘" : @""];
    

    You might also want to have a look at Allan Odgaard’s blog post “Deciphering an NSEvent” about the heuristic he developed for deciding what keys were being pressed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been devastated last two days looking and reading about all kind of errors.
I have been reading for the last two days about indexes and how to
I have been reading about UnitOfWork pattern for last two days but didn't understand
I've been doing a lot of reading these last two days on Microsoft Prism,
In the last two days, ive run across code that has php echo'd variables
I've been working with WCF the last two days and it was going very
For the last two days I have been searching for an answer to this
I've been beating my head against my desk for the last two days over
For the last two days I have tried just about everything to get a
I've been all over the place for the last two days trying to find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.