I have an NSWindow and basically, what I am trying to pop up an NSWindow outside of the bounds of the NSWindow it's in every time a user hovers over the NSWindow.
But every time I try to do that, since the NSView is outside of the bounds of NSWindow it gets cut off.
Here's a picture of what I am trying to achieve:
You need to create a borderless NSWindow
, large enough to contain your view, and make the window a child window of the main window it's attached to. To make a window a child of another window, you use the addChildWindow:ordered:
method of NSWindow
.
Child windows are attached to the parent window and will move with their parent window when the parent window moves. If you just open a new window without making it a child window, it will be "left behind" if the other window is moved.
To make a borderless window, pass NSBorderlessWindowMask
as the styleMask
to the initWithContentRect:styleMask:backing:defer:
method of NSWindow
.
The easiest approach is to create another NSWindow
with no border and put the button in that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With