PDA

View Full Version : Ugly NSWindow mask


Steven
2004.06.27, 12:28 PM
Sorry for so many questions at once - these have been piling up during the downtime. So I'm also creating NSWindows programatically to eliminate the need for a nib file in this particular instance (it's a static library; extra files are a pain)
Here's what I have:
progress = [[[NSWindow alloc] initWithContentRect:NSMakeRect(100,100,400,50) styleMask:NSTitledWindowMask | NSTexturedBackgroundWindowMask backing:NSBackingStoreRetained defer:NO] autorelease];
[progress center];

bar = [[[NSProgressIndicator alloc] initWithFrame:NSMakeRect(14,5,372,25)] autorelease];
status = [[[NSTextField alloc] initWithFrame:NSMakeRect(14,33,372,20)] autorelease];

[status setBezeled:NO];
[status setBordered:NO];
[status setEditable:NO];
[status setSelectable:NO];
[status setDrawsBackground:NO];

[status setStringValue:@"Checking for new versions..."];

[[progress contentView] addSubview:bar];
[[progress contentView] addSubview:status];
[progress setHasShadow:YES];
[progress invalidateShadow];

[progress makeKeyAndOrderFront:self];

It works perfectly except that there are ugly black areas where the window should be transparent (around the rounded corners). How do I enable the transparency? Thanks,
Steven

arekkusu
2004.06.27, 05:10 PM
Read the NSWindow doc:
[progress setOpaque:NO];

see also
[progress setAlphaValue:0.5f];

Steven
2004.06.27, 05:30 PM
Whoops. I saw that, but it didn't seem like what I wanted. But upon thinking about it again, yeah it does make sense - I just assumed that the default would be like that.

Steven
2004.06.27, 11:02 PM
Actually, that didn't help. I still have black 'handles' in the corners.