Re: NSButtonCell subclass (partially transparent images)
Re: NSButtonCell subclass (partially transparent images)
- Subject: Re: NSButtonCell subclass (partially transparent images)
- From: Darrin Filer <email@hidden>
- Date: Fri, 8 Feb 2002 22:55:59 -0500
Thanks for the assistance but I'm still at an impass and about to
rewrite NSButton's functionality from scratch. Seems like buttons with
semi-transparent images would be something that cocoa would support.
However, most people who have replied to my various posts have indicated
that they subclassed NSView eventually to solve the problems.
In the quoted block of code the debugger provides the following info:
cellFrame.origin is always {0,0}
[self image] is loaded and its dimensions match that of the loaded file
controlView is indeed the NSButton which contains the cell
There is no other code that draws into the view. The button is not
transparent. It responds to mouse clicks in the properly. Thus, the
contol's view is in the right location and of the correct size.
Am I missing something obvious here or can button cells simply not draw
into their control views properly?
darrin filer
On Friday, February 8, 2002, at 09:53 PM, Erik M. Buck wrote:
I have annotated your code:
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView {
[controlView lockFocus]; // NOT NEEDED
[[self image] compositeToPoint:cellFrame.origin
operation:NSCompositeCopy];
[controlView unlockFocus]; // NOT NEEDED
[controlView setNeedsDisplay:YES]; // NOT NEEDED
}
Assuming that [self image] is properly loaded, why would this code not
draw anything?
if [self image] returns non-nil and cellFrame.origin is in the visible
portion of controlView and drawInteriorWithFrame:inView: is actually
being
called then it should draw the image.
See http://www.stepwise.com/Articles/Technical/NSCell.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.