0

I have a application, where I have to capture the paste event for the NSTextField. Two scenario is required: If text is typed, call goes to controlTextDidChange If paste action is done in text field, again this controlTextDidChange delegate is called. I need to differentiate between Paste action and type action NSTextField. It is required as I need to call separate function.

Please suggest, how to capture Paste Action for the NSTextField.

Thanks in Advance. Raghunath

1 Answers1

1

Welcome to Stack Overflow.

You can intercept the paste command by using a custom field editor and overriding paste. Documentation:Text Fields, Text Views, and the Field Editor and Using a Custom Field Editor.

This answer might be helpful: NSTextField: exposing its Copy and Paste methods. You don't have to use a subclass of NSTextFieldCell, you can also use the method windowWillReturnFieldEditor of NSWindowDelegate.

Community
  • 1
  • 1
Willeke
  • 14,578
  • 4
  • 19
  • 47