Re: The Cell from Hell (TM)
Re: The Cell from Hell (TM)
- Subject: Re: The Cell from Hell (TM)
- From: Glen Low <email@hidden>
- Date: Sat, 8 May 2004 00:55:26 +0800
Matt:
On 06/05/2004, at 11:28 PM, email@hidden wrote:
Message: 11
Date: Thu, 6 May 2004 08:05:23 -0700
From: matt neuburg <email@hidden>
Subject: Re: The Cell from Hell (TM)
To: email@hidden
On Thu, 6 May 2004 08:05:10 +0800, Glen Low <email@hidden>
said:
On 06/05/2004, at 5:22 AM, John Randolph wrote:
On May 5, 2004, at 1:32 AM, Glen Low wrote:
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
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
If you alloc-init-autorelease an NSCell and hand it to two
NSTableViews (with setDataCell or whatever), memory management is
taken care of properly. Or, NSCells are copyable. I guess what I'm
wondering is why it is "easiest" to go against the grain of the
framework. m.
Not quite (at least for NSTextFieldCells). The NSCell does not retain
the NSTableView (otherwise there would be a retain cycle and/or it is
shared), but nevertheless keeps a reference to it which you can inspect
using controlView:. Now if last NSTableView goes away, the NSCell will
die trying to be displayed in the other NSTableView (or even copied).
NSCells are indeed copyable, and apparently NSTableView do a lot of
copying when you edit the cell. However not everything survives a copy
-- I had some code that used copied NSCells to get around this problem,
and the placeholder strings were all missing. Moreover, if you have a
long menu, I suspect (but haven't confirmed) the menu gets copied too,
which is non-trivial.
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.