Quick tip time! This is an anecdote from a libre project I’m working on, specifically Auctions.
One of the things I am doing right now is implementing the Cocoa/Mac UI. I’m writing a flow using sheets for signing in to accounts. I had a lot of issues making the sheet accept input; it just wouldn’t let any of its fields become the first responder.
Poking around DuckDuckGo, I found a Stack Overflow question that seemed pretty interesting, and the answer was to override
canBecomeKeyWindow method to return
YES. I did some searching around in Apple’s Developer Documentation to see how the system determines when a window can become a key window, and I found this nugget:
A window that uses– Apple Developer Documentation
NSWindowStyleMaskBorderlesscan’t become key or main, unless the value of
YES. Note that you can set a window’s or panel’s style mask to
NSWindowStyleMaskBorderlessin Interface Builder by deselecting Title Bar in the Appearance section of the Attributes inspector.
I had turned off Title Bar in Interface Builder as I thought it should be disabled since the window would be shown as a sheet. I re-enabled Title Bar, and voila! The sheet worked perfectly, and did not have a title bar when displayed as a sheet.