• 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: The Cell from Hell (TM)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The Cell from Hell (TM)


  • Subject: Re: The Cell from Hell (TM)
  • From: Glen Low <email@hidden>
  • Date: Thu, 6 May 2004 08:05:10 +0800

jcr:

On 06/05/2004, at 5:22 AM, John Randolph wrote:


On May 5, 2004, at 1:32 AM, Glen Low wrote:

Hi All,

Just thought I'd save some souls from hours of fruitless debugging. (somewhat apropos given the title of this email :-) )

NSCells are the best thing since sliced bread -- a lightweight control and everything. However, there is a subtle bug with them. If you draw them in a view as you must, and later on the view goes away e.g. if the window goes away, the cell now has a dangling reference to the view!! Then most operations on it will fail with a SIGTRAP e.g. setObjectValue, setFont, copy ... you'll need to manually flush the dangling reference with a

[cell drawFrame: NSZeroRect inView: nil]

just to clear it up.

Ordinarily, a cell belongs to a particular view and once the view has been dealloced, the cell doesn't exist anymore.


Ah but transferring cells between existing views works well. Consider the case of a couple of NSTableViews having different sorts of row content but similar content between views; the easiest solution is for them to "share" some NSCells -- in which case the cells really have no single parent view. The docs on cells also talk about "last drawn view" as opposed to "owner or parent view" and all the functions have the Flyweight pattern -- pass in the NSView as context rather than keep it.

Cheers, Glen Low


---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >The Cell from Hell (TM) (From: Glen Low <email@hidden>)
 >Re: The Cell from Hell (TM) (From: John Randolph <email@hidden>)

  • Prev by Date: OutlineView to TableView to TextView binding, oh my...
  • Next by Date: Re: Drawing subviews, then the parent view
  • Previous by thread: Re: The Cell from Hell (TM)
  • Next by thread: Re: The Cell from Hell (TM)
  • Index(es):
    • Date
    • Thread