Re: Trying to get flagsChanged: to work
Re: Trying to get flagsChanged: to work
- Subject: Re: Trying to get flagsChanged: to work
- From: Dave DeLong <email@hidden>
- Date: Sat, 25 Apr 2009 11:19:57 -0600
After some more investigation...
It seems that the responder chain is not set up during awakeFromNib
(even though all the outlets are), because I moved the loop to my
addGroup: IBAction, where it printed off my chain. My
GroupListController was not in the chain. Shouldn't it be? Doesn't a
view's controller get a chance to respond to anything that the view
doesn't respond to?
Dave
On Apr 25, 2009, at 11:05 AM, Dave DeLong wrote:
Hi everyone,
I'm building a master-detail interface with several IB-instantiated
NSViewController subclasses. I've got a controller for my group
list on the left (GroupListController), a controller for the list of
items (ItemListController), and another controller for the selected
item (ItemController).
I'm trying to detect when the user presses the option key so that I
can change the "Add Group" button to an "Add Smart Group" button.
So far, my attempts have been pretty unsuccessful. I noticed that
NSViewController is a subclass of NSResponder, so I thought that I
could simply implement flagsChanged: in my GroupListController.
However, it *never* gets fired (nor do any other events, like keyUp,
keyDown, etc). I've tried setting the initialFirstResponder to be
the groupList, manually making the groupList becomeFirstResponder
(after ensuring that acceptsFirstResponder returns YES), and so on.
One thing that's curious to me is the following in
GroupListController's awakeFromNib method:
NSResponder * next = [[NSApp keyWindow] firstResponder];
while (next) {
NSLog(@"%@", next);
next = [next nextResponder];
}
That code *never* prints anything. Is the responder chain empty?
How can it be, if my groupList is the window's initialFirstResponder?
All I want to do is know when the option key is pressed. I realize
that I can implement a CGEventTap and find out that way, but given
the flagsChanged method, a tap seems like overkill to me.
Any ideas what I'm doing wrong?
Thanks,
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden