• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iTableView and subclassing NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iTableView and subclassing NSTableView


  • Subject: Re: iTableView and subclassing NSTableView
  • From: Jerry Krinock <email@hidden>
  • Date: Fri, 13 Feb 2009 22:31:13 -0800


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@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


References: 
 >iTableView and subclassing NSTableView (From: Stephen Zyszkiewicz <email@hidden>)

  • Prev by Date: Re: Images In Dock Menu?
  • Next by Date: Where to declare/initialise an NSOperationQueue
  • Previous by thread: iTableView and subclassing NSTableView
  • Next by thread: Re: iTableView and subclassing NSTableView
  • Index(es):
    • Date
    • Thread