Trying to get flagsChanged: to work
Trying to get flagsChanged: to work
- Subject: Trying to get flagsChanged: to work
- From: Dave DeLong <email@hidden>
- Date: Sat, 25 Apr 2009 11:05:13 -0600
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