hollow7
hollow7

Reputation: 1506

How to make active a window without a title bar

I can send the message makeKeyAndOrderFront: to make a window active. However, if I send this to a window without a title bar, it doesnt make it active. Is there any way to make a window without a title bar active?

Upvotes: 4

Views: 917

Answers (1)

Rob Keniger
Rob Keniger

Reputation: 46020

You need to override -canBecomeKeyWindow in your NSWindow subclass to return YES.

As per the docs:

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

Upvotes: 4

Related Questions