Re: Custom NSView/NSWindow & First Responders
Re: Custom NSView/NSWindow & First Responders
- Subject: Re: Custom NSView/NSWindow & First Responders
- From: Michael Ash <email@hidden>
- Date: Thu, 11 Jun 2009 02:27:51 -0400
On Wed, Jun 10, 2009 at 9:34 PM, John Ku<email@hidden> wrote:
> Good afternoon all,
> Im having trouble setting the correct first responder / key window in my
> app.
>
> I have a subclass NSWindow with NSBorderlessWindowMask and a custom drawing
> NSView inside the window. So the window is transparent showing the NSView's
> drawing. The NSView image is drawn with NSDrawThreePartImage to create a
> resizable window.
>
> The problem is this: if i have an instance of NSTextField created within the
> NSView or NSWindow, the text field is selectable with mouse but does not
> accept keyboard events.
>
> I have my NSView set acceptsFirstResponder & becomeFirstResponder to return
> YES but still no dice.
By default, an NSWindow created with NSBorderlessWindowMask cannot
become the key window and thus cannot accept keyboard events. Subclass
NSWindow and override -canBecomeKeyWindow and it should work better
for you.
Mike
_______________________________________________
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