Re: receiving key equivalent events
Re: receiving key equivalent events
- Subject: Re: receiving key equivalent events
- From: Chuck Soper <email@hidden>
- Date: Mon, 14 Jun 2004 10:03:21 -0700
Thanks for your response. (I'd like to avoid adding the menu items to
the main menu.) I would like to handle the event in my main window,
but I'm not sure how. My main window is an NSWindowController
subclass. I think that I could implement:
- (void)sendEvent:(NSEvent *)theEvent
in a NSWindow subclass. Yet, I don't have a NSWindow subclass (and
I'd kind of like to avoid creating one).
It just occurred to me that I could simply add an identical
NSPopUpButton menu to my main window. I would keep that NSPopUpButton
in it's own view in the nib and not display it in the main window.
When I respond to the NSPopUpButton action in the main window I would
forward the message to the inspector window. I think this should work
fine. I'll try implementing it today.
I wonder how IB allows the user to use command keys for the inspector
when a document window is in front of the inspector window.
Chuck
At 9:53 AM -0400 6/14/04, Brent Gulanowski wrote:
According to the documentation, the Responder Chain for events only
includes the key window's views and itself -- nothing past that window.
So either you will have to handle the event in the main window (perhaps
by passing it on to the inspector's delegate directly), or add menu
items to the main menu that respond to those command keys. You can keep
the popup menu, but it need not have key equivalents (and if they're
the same they won't register anyway). The menu items in the main menu
can then send their actions to first responder. The action responder
chain includes all windows, their delegates, and the application
delegate, so if your panel's delegate implements actions to enable
changing the inspector view, those messages will eventually arrive and
you can set things up as you like.
Cheers,
On Jun 13, 2004, at 3:59 AM, Chuck Soper wrote:
I think the only way to do this is to subclass NSApplication and
override:
- (void)sendEvent:(NSEvent *)anEvent
but this seems like an overkill. Does anyone know the solution to what
I've described below?
Chuck
At 12:20 PM -0700 6/12/04, Chuck Soper wrote:
Hello,
I have an inspector window similar to the one in Interface Builder
(IB). It has a NSPopUpButton menu with command key equivalents of 1,
2, 3, and so on. My inspector window only responds to command key
equivalents when it is front most (this makes sense to me).
>> Using command key equivalents, how can I change the current menu item
>> of inspector window's NSPopUpButton menu when when another window in
front most? The other window is an NSWindowController subclass. I
think that this is a very straightforward question, but I haven't
been able to find the answer. I think that I have to catch the event
in my window controller or perhaps my application delegate then send
a message to the inspector window to select new item in its
NSPopUpButton menu. Any ideas?
Thanks,
Chuck
--
Brent Gulanowski email@hidden
[demime 0.98b removed an attachment of type
application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.