You want to subclass NSWindow and override -sendEvent:, which will let you get at the keyboard events before the rest of the standard event handling stuff gets at it. You will use your subclass of NSWindow for your windows.

Alternately you could subclass NSApp and override -sendEvent: there. I did something similar by subclassing NSWindow, but you may find that you need to hijack the event earlier in the process (e.g. at NSApp). Try both ways.

See http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/EventOverview/Introduction/chapter_1_section_1.html for details, specifically the section on Event Dispatch.

On Feb 11, 2009, at 2:28 PM, Andy Bell wrote:

Hi All,

I am working on a project which is an Agent and just has a couple on Windows and a menu bar icon. The menu bar icon has a menu which is used to call up the two windows. Now I want to add 'Command-V' so that I can paste into the NSTextFields in this window, as I don't have the standard Edit menu I need to catch this command in some other way. I did first try to add a menu item for pasting in the menu bar menu and hooking it into the First responder
paste selector but that didn't work.  Any ideas?

Thanks in advance
Andy
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/dev_staff%40medhavisoftware.com

This email sent to dev_st...@medhavisoftware.com


Jeffrey Dutky
Senior Software Engineer
Medhavi Software Inc.
jeff...@medhavisoftware.com

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to