Hello I was wondering if anyone could shed some light how I may enable/disable redrawing of any class inherited from a nsview?
I know Windows has a message you can send to a hwnd to enable/disable gadget painting messages. This also then propagates to child hwnds too. Is there an equivalent method in Mac development?
I have an existing GUI library and I was wondering if there is a method to do this that doesn't require modification of the existing source code?
If the problem is that you're doing a lot of control layout work and don't want drawing to occur while this is happening, you can use either [NSWindow disableScreenUpdatesUntilFlush]
or the global NSDisableScreenUpdates()
and NSEnableScreenUpdates()
functions to prevent the screen updating until you're ready.
I am not sure exactly what you are trying to do, but imagine you have an NSView subclass that has a draw method
.h
BOOL shouldDraw;
.m
-(void)drawRect:(NSRect)someRect
{
if(shouldDraw)
{
[super drawRect:someRect];
}
}
if you never call super's implementation of draw, nothing will get drawn.