Re: Forcing ordered-out-window to adjust position
Re: Forcing ordered-out-window to adjust position
- Subject: Re: Forcing ordered-out-window to adjust position
- From: Philip White <email@hidden>
- Date: Sat, 15 May 2010 14:31:29 -0500
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 (email@hidden)
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:
This email sent to email@hidden