Can I associate a child NSWindow with a parent?

I have a borderless NSWindow, which I add as a child window to the main application window. In a certain mode, the child window may lie partially outside the parent window and then scale forward, so it is completely closed.

If the main window is not full-screen, then it looks odd for the child window to go beyond the main window. Can I fix it?

+4
source share
1 answer

No, I do not think so. In OS X, windows (and thereby NSWindow s) are composed by a window server and have their own buffers. Theyre essentially OpenGL quadrants, and the drawing is done in texture (this is a simplification, but it basically works).

You will not explain in your question why you are using a child window (unlike, for example, with support for a layer or even a simple NSView ); often you may not have to use child windows at all, which seems to be the easiest solution to your problem in this case.

(Note that if you came from a Windows background, Cocoa expects you to use views rather than windows for most purposes, in a typical application you only need to use windows at the top level of the interface hierarchy.)

+1
source

Source: https://habr.com/ru/post/1479916/


All Articles