On 16/06/2012, at 4:06 AM, Kyle Sluder wrote: > Your best bet is probably to retarget the Paste menu item to use a different > selector that is picked up by your window controller.
Thanks Kyle, Unfortunately the standard paste: selector is used extensively elsewhere in my app, so this simple solution would not be so simple. This is an otherwise very self-contained modal dialog that doesn't have much to do. I solved it as follows: My window controller, which is the window's delegate, implements -windowWillReturnFieldEditor:forObject:. I return a subclass of NSTextView which overrides -paste: and adds a property, -pasteDelegate: which I set to be the window controller. (I believe the FE's nextResponder is usually also the windowController, but I wasn't entirely sure I could rely on that, so I just added an extra property to hook it up). Then I just punt -paste to the -pasteDelegate (and also -validateMenuItem for that action). Works great. In conjunction with some text editing delegate methods I have excellent control over the text fields and the subclassing was absolutely minimal. --Graham _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com