On 10 Sep 2014, at 23:32, Ken Thomases <k...@codeweavers.com> wrote:
> On Sep 10, 2014, at 4:07 PM, Luc Van Bogaert <luc.van.boga...@me.com> wrote: > >> No succes so far with this. >> >> I subclassed NSPanel and overridden: >> >> - (BOOL) becomesKeyOnlyIfNeeded >> { >> return YES; >> } >> >> - (BOOL) canBecomeKeyWindow >> { >> return YES; >> } >> >> I also subclassed the collection view in the panel and overridden: >> >> - (BOOL) acceptsFirstResponder >> { >> return NO; >> } >> >> - (BOOL) needsPanelToBecomeKey >> { >> return NO; >> } >> >> Clicking the collectionview still makes the panel the key window, which is >> exactly what I'm trying to avoid. > > What about the view hierarchy of the item that's actually been clicked within > the collection view? What is actually becoming first responder? > > Also, the release notes from when -becomesKeyOnlyIfNeeded was added seem to > imply that it's for panels with NSNonactivatingPanelMask in their style mask. > The rest of the docs don't include the same caveat, but it's worth checking. > Those times I checked, it was the panel itself that was the first responder. BUT, in the meantime, I decided to retry another route that I had been experimenting with the last couple of days, and I have now found a working solution, although maybe a little complicated. It involves 'listening' for the mouseDown: event that is sent to the NSThemeFrame object when you click the panel's titlebar. I'm using the panel's 'awakeFromNib' to replace the default NSThemeFrame' mouseDown: method with my own implementation which allows the panel to become key (setting a BOOL property), and then I send the panel a 'makeKeyWindow:' message. Second, I'm using the window delegate to reset the ability of the panel to become key in 'windowDidResignKey:'. So once I click out of the panel, its ability to become key is switched back off again and things are back to their initial state. I still am going to have to optimise this a little bit in the next few days. Anyway, thanks for all the help and advice. -- Luc Van Bogaert
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com