[Solution] Why no transparent window?
[Solution] Why no transparent window?
- Subject: [Solution] Why no transparent window?
- From: j o a r <email@hidden>
- Date: Tue, 25 Sep 2001 04:39:39 -0700
In answer to my own question...
I lied a bit when I presented the example for you below. In reality I
created my window with a NSZeroRect - because at the time when I create
the window I don't know the location and size it will eventually need to
have when used. I didn't think that it would make any difference, since
I resize it before using it later on.
It seems like you cannot do that, at least not if you later want to be
able to use the window with a transparent background. If I create the
window with any other rect - NSMakeRect(0.0,0.0,1.0,1.0) for example- it
works fine.
I didn't discover the problem until I got really frustrated and created
a new empty demo-project with only this code. That always seems to
help - perhaps next time I'll try that first...
Thanx again to all of you who tried to help out!
j o a r
On Monday, September 24, 2001, at 01:13 , j o a r wrote:
If I open a window like this:
myWindow = [[NSWindow alloc]
initWithContentRect:NSMakeRect(100.0,100.0,500.0,500.0)
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
// This window should be transparent
NSLog(@"isOpaque: %d", [myWindow isOpaque]);
[myWindow setOpaque:NO];
NSLog(@"isOpaque: %d", [myWindow isOpaque]);
[myWindow makeKeyAndOrderFront:self];
The window still shows up with the striped background - does any one
know why?
The log output indicates that the "setOpaque" call was effective - ie.
1 before and 0 after.