Re: Overiding NSButton initWithFrame: (doesn't work)
Re: Overiding NSButton initWithFrame: (doesn't work)
- Subject: Re: Overiding NSButton initWithFrame: (doesn't work)
- From: Darrin Filer <email@hidden>
- Date: Fri, 1 Feb 2002 16:58:41 -0500
Came across another problem as well...
My buttons use an image with transparent corners. Thus I should be able
to see brushed metal behind the rounded edges of the button. However, it
shows up white instead. The image definately contains transparency since
when the button is clicked down, only opaque areas of its image are
darkened.
Here's the code I use to set the button's image.
[workingImage lockFocus];
[sourceImage drawInRect:leftSourceRect fromRect:leftSourceRect
operation:NSCompositeSourceOver fraction:1];
[sourceImage drawInRect:middleDestRect fromRect:middleSourceRect
operation:NSCompositeSourceOver fraction:1];
[sourceImage drawInRect:rightDestRect fromRect:rightSourceRect
operation:NSCompositeSourceOver fraction:1];
[workingImage unlockFocus];
[self setImage:workingImage];
I've even overridden isOpaque like this:
- (BOOL)isOpaque { return FALSE; }