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 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to