Search code examples
cocoaselectionnstextfield

How to handle text selection in NSTextField


probably this is documented somewhere but i just can't find how to handle the event of text selection in a NSTextField, i wan't to respond to the event of the user highlighting some text, i wan't to get the selected text and do something with it.


Solution

  • I've managed to fix the problem by subclassing NSTextField and overriding - (void)textViewDidChangeSelection:(NSNotification *)aNotification