Re: Custom NSCell mouse events
Re: Custom NSCell mouse events
- Subject: Re: Custom NSCell mouse events
- From: Corbin Dunn <email@hidden>
- Date: Mon, 14 Jun 2010 08:42:04 -0700
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 (email@hidden)
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:
This email sent to email@hidden