Re: background of NSButton and NSPopUpButton
Re: background of NSButton and NSPopUpButton
- Subject: Re: background of NSButton and NSPopUpButton
- From: Ryan Stevens <email@hidden>
- Date: Thu, 25 Nov 2004 14:47:21 -0800
On Nov 25, 2004, at 1:11 PM, Don Willems wrote:
[snip]
I've been playing around some with subclassing NSButtonCell, but I just can't get it to work. None of the methods in my subclass gets called. I tried to set the Cell class with +setCellClass in NSControl, I've overridden +cellClass, also in NSControl to return my subclass. But nothing seems to have any effect.
The only thing that had some effect was using setCell, but that resulted in ugly windows like buttons without an image.
How do you change the cell of a button?
Thanks for your help,
From the docs on NSControl...
"-(void)setCell:(NSCell *)aCell
Sets the receiver’s cell to aCell. Use this method with great care as it can irrevocably damage the affected control; specifically, you should only use this method in initializers for subclasses of NSControl."
So, I would subclass NSButton, in its -
initWithCoder: I would create the cell and then [self setCell:theCell];
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden