On May 15, 2010, at 12:43 PM, Scott Ribe wrote:

> If you can't get a direct answer to your question, could you create a 
> subclass of NSWindow with a couple of very simple overrides:
> 
> - (void) display
> {}
> 
> - (void) displayIfNeeded
> {}
> 
> You couldn't leave it out lest it muck with event handling, but you could 
> order it in, position it, check its position, and order it out.
> 
> -- 
> Scott Ribe

Hello again,
  Providing blank overrides of those two methods isn't quite enough it seems. 
The following will draw an invisible window though:

-(void)display
{
        /* seems to be unnecessary?
        NSGraphicsContext *context = [NSApp context];
        NSGraphicsContext *oldContext = [NSGraphicsContext currentContext];
        [NSGraphicsContext setCurrentContext:context];*/
        
        NSView *tv = [[self contentView] superview]; //theme view
        [tv lockFocus];
        [[NSColor clearColor] set];
        NSRectFill([tv bounds]);
        [tv unlockFocus];
        
        //[NSGraphicsContext setCurrentContext:oldContext];
}

-(void)displayIfNeeded
{
        [self display];
}

Also, you need to call setOpaque:YES on the window.

I haven't actually tried to see if I can use this to solve my problem though. I 
suspect it will work nicely however. Hopefully it doesn't cause any problem.
Also I'm not sure that it will cause event problems if left ordered in. Cocoa 
passes mouse clicks through transparent parts of windows. Just have to make 
sure it doesn't end up in the Window menu and whatnot.

Thanks again,
  Philip White

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to