Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

monsieurpaul

macrumors regular
Original poster
Oct 8, 2009
230
0
Hello,

I am looking for a type of textfield (or a particular option in NSTextFIeld) that allows to shows the modifier keys that are used. For example, the textfield would show the "⌥" glyph when I press the option key.

So far I have found external framework such as ShortcutRecoder but I don't know if there are more straightforward solutions.

Thanks,

Paul
 
I'm just kinda going off memory here, but you might have to subclass the NSTextField or NSTextView and override the keyDown method.

You might look at the delegate methods for controlTextDidBeginEditing, controlTextDidChange, and controlTextDidEndEditing, but those might not catch modifier keys.

Edit:

A little googling found this. In particular it mentions detecting the keydown events in a NSTextView delegate:

http://www.cocoadev.com/index.pl?NSTextField
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.