On 2009 Feb 13, at 18:31, Stephen Zyszkiewicz wrote:

The problem is that the checkboxes within the table are not being unchecked/checked.

Yes, that was rather surprising.  I pounded on my mouse a few times.

Do I need to implement a keydown event in SourceListTableView? If so, how do I do this so that the proper checkboxes are checked/ unchecked?

Step back.  There are two alternate ways to do this.

The first way, what you appear to be proposing, is to build a cell from scratch. This can be done, and it may be the only way if you really want to have those colors inside the boxes. Today, you'll be happy to see the box check and uncheck, but sooner or later you might end up re-implementing a whole lot of behavior (enable/disable, selected/unselected, NSCoding, bindings, etc.) that Apple has already provided in NSButtonCell. I did this a couple years ago, making a radio button cell. 359 lines of code. Let me know if you want it. To answer your question, it looks like I did not implement keyDown: or mouseDown:.

To appreciate the alternate way, understand what you're looking at there with Matt's checkbox is a SourceListImageCell, Matt's subclass of NSImageCell. Notice that the other column is a SourceListTextCell, Matt's subclass of NSTextFieldCell. The alternate way, following these two examples, would be to write your own SourceListButtonCell, as a subclass of NSButtonCell. Although I'm not much of a drawing guru, I'd try and let super draw the checkbox in my drawInteriorWithFrame: implementation and then composite the colors, images, gradients whatever over or under it. Although some compromises on the cosmetics may be necessary, you see Matt did this in only 50-60 lines of code.

It's kind of confusing that Matt used an image of a checkbox to demonstrate an image. The demo would be easier to understand had he used a little apple or something.

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to