FROM : Ryan Stevens
DATE : Thu Nov 25 23:47:21 2004
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];
DATE : Thu Nov 25 23:47:21 2004
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];
| Related mails | Author | Date |
|---|---|---|
| Don Willems | Nov 25, 11:20 | |
| Michael Becker | Nov 25, 12:00 | |
| Don Willems | Nov 25, 13:32 | |
| Michael Becker | Nov 25, 15:25 | |
| Don Willems | Nov 25, 22:11 | |
| Ryan Stevens | Nov 25, 23:47 | |
| Don Willems | Nov 26, 09:15 | |
| Don Willems | Nov 26, 09:22 |






Cocoa mail archive

