• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unable to receive keyDown Event in NSBorderlesswindow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unable to receive keyDown Event in NSBorderlesswindow


  • Subject: Re: Unable to receive keyDown Event in NSBorderlesswindow
  • From: Ron Fleckner <email@hidden>
  • Date: Thu, 11 Mar 2010 23:58:18 +1100


On 11/03/2010, at 10:57 PM, Poonam Virupaxi Shigihalli wrote:


Hi,

I am using NSBorderless style mask for window and I am unable to receive the NSKeyDown event for that window.But if I make the window style as titled then I am able to receive the keyDown events.

I am using below function for Keydown event:

- (void)keyDown:(NSEvent *) event




Thanks, Poonam

Hello Poonam,

in your window subclass, you need to override -canBecomeKeyWindow to return YES

From the NSWindow class reference:

canBecomeKeyWindow
Indicates whether the window can become the key window.

- (BOOL)canBecomeKeyWindow

Return Value
YES if the window can become the key window, NO otherwise.

Discussion
Attempts to make the window the key window are abandoned if this method returns NO. The NSWindowimplementation returns YES if the window has a title bar or a resize bar, NO otherwise.




Hope that helps,

Ron
_______________________________________________

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


References: 
 >Unable to receive keyDown Event in NSBorderlesswindow (From: "Poonam Virupaxi Shigihalli" <email@hidden>)

  • Prev by Date: Re: Unable to receive keyDown Event in NSBorderlesswindow
  • Next by Date: EXC_BAD_ACCESS
  • Previous by thread: Re: Unable to receive keyDown Event in NSBorderlesswindow
  • Next by thread: EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread