On Jun 10, 2010, at 9:43 AM, Michael Hanna wrote:

> OK I'm really stumped on this one. I want to make a checkbox with a
> NSTextFieldCell combined together. It's important that the checkbox
> goes ON if the mouse hits the box, NOT the text. I've accomplished
> this, more or less, but the issue is receiving the mouse event because
> I click one checkbox in a row, but ALL of them turn to NSOnState. I
> will show what I've done and my various failed attempts in order to
> get this to work.
> 
> So this is how I've done it so far:
> 
> header:
> @interface MyCheckboxCellToo : NSTextFieldCell {
>    NSButtonCell *_checkboxCell;
> }

> 
> implementation:

<snip>

You're missing an implementation of copyWithZone that copies the _checkboxCell 
ivar.

Hence, all use the same instance and show the same stuff. You'll also 
eventually get a crash because the default implementation of copyWithZone is 
just a bitwise copy of the class.

corbin

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to