gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView and nil window


From: Wolfgang Lux
Subject: Re: NSView and nil window
Date: Thu, 26 May 2016 14:06:33 +0200

> Am 26.05.2016 um 12:10 schrieb Riccardo Mottola <address@hidden>:
> 
> Hi,
> 
> it is acceptable to have and manipulate a NSView without it being inside a 
> window?

Yes, you can take out a view from the view hierarchy inside a window to make it 
invisible (although IIRC Apple recommends to just hide the view in that case) 
or to move it from one window to another. You can freely change the view's 
dimensions and contents while it is not associated with a window. However,

> Does it make sense to also draw it?

No. In the end, it is the window you are drawing to that determines the 
graphics context and without that there is nothing you can draw. Also, usually 
you don't draw a view yourself, but only when the window that contains the view 
asks you to do so. This is for optimized drawing, so that you can restrict 
drawing to just that part of a window that is actually visible. If you really 
need to draw a view that is not visible, create an offscreen window for that 
and attach the view to it.

Wolfgang




reply via email to

[Prev in Thread] Current Thread [Next in Thread]