On May 17, 2014, at 2:56 AM, Roland King wrote: > I have a custom NSView (actually subclass of NSTextField) in which I've > overridden acceptsFirstResponder to return YES whether the superclass text > field is editable or not. It also returns YES to canBecomeKeyView. I have 6 > of them on-screen and lots of logging. The 6 are dynamically added, not from > a nib. > > When the app starts the first one is asked if it can become first responder, > says YES, asked it it can become key, says YES and indeed becomes first > responder and hitting a key shows that view is getting keys it because it > logs. > > If I mouse-click on another of the windows that window is asked if it can > become first responder, it says YES, but nothing changes. The first one isn't > asked to resign, the one I just clicked doesn't become first responder, it's > not asked if it can become key, the key focus stays the same (another > keypress is still handled by the same first custom view). I log the first > responder each time and it never changes. > > The windows are chained to be each others nextResponder and nextKeyView. I > can't find anything else to override. Surely the clicked NSView subclass > should just become first responder (and key).
Are you familiar with the concept of the field editor? You should search the docs and read up on it. A text field never becomes the first responder, as such. It uses a field editor and that's the first responder. Also, make sure your overrides are calling through to super. Regards, Ken _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [email protected]
