I have a window that I want users to be able to move by dragging anywhere in the window content (not just the titlebar). I know that this can be done via the NSWindow movableByWindowBackground
method, however this doesn't appear to work by itself.
I gather that overriding NSView mouseDownCanMoveWindow
may be necessary. But I can't easily do that for all parent views (split views, etc). Making it a textured window didn't help. Unsurprisingly, subclassing NSWindow
to override isMovableByWindowBackground
didn't help either.
Is it really necessary to subclass all parent views in the window to make this work?
On OS X 10.11, setting the NSWindow's property movableByWindowBackground
to YES
works.
There is no longer any need to subclass for this behaviour.
In NSSplitView you add:
override var mouseDownCanMoveWindow: Bool {
return true
}
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