Re: Why do all subcell buttons highlite for custom cell in NSTableView?
Re: Why do all subcell buttons highlite for custom cell in NSTableView?
- Subject: Re: Why do all subcell buttons highlite for custom cell in NSTableView?
- From: Guy Umbright <email@hidden>
- Date: Tue, 10 Jan 2006 21:31:29 -0600
Corbin,
Of course, that would make sense. That was bothering me that if
there is only one cell instance
how would they behave differently? I will implement the copyWithZone
and post the result (so it
is in the archives. Thank you so much.
As for the memory leak, its first cut code but thanks for pointing it
out.
Ron: Sorry to have not responded but somehow I never got your
response. Thanks.
Guy
On Jan 10, 2006, at 6:34 PM, Corbin Dunn wrote:
On Jan 7, 2006, at 3:46 PM, Ron Wilson wrote:
Your drawInteriorWithFrame will draw the m_buttonCell with it's
current settings.
- (BOOL) startTrackingAt: (NSPoint) startPoint inView:(NSView*)
controlView
{
if (NSMouseInRect(startPoint, m_buttonFrame,NO) == YES)
{
[m_buttonCell highlight:YES withFrame:m_buttonFrame
inView:controlView];
The state of m_buttonCell is now highlighted.
[self _RunPanel];
Before this next statement, drawInteriorWithFrame must be being
called for all the table rows and hence all the buttons will be
drawn highlighted. Try logging the calls to drawInteriorWithFrame
or set a breakpoint to see that this is in fact happening.
Just to correct this a little bit. Before tracking occurs, the cell
is copied. That way, it can reflect a state that is different from
all other cells being drawn. Because m_ButtonCell and the other
ivars are not copied (since copyWithZone: isn't implemented), the
copied cell will be using the other ivars; they themselves should
be copied.
Also, the code shown has a memory leak. If, in dealloc,
[_mButtonCell release] was called, eventually there would be crash,
since the ivar instances would be copied, but not retained, and the
extra release would overrelease and crash. Does this make sense? if
not, i can elaborate.
-corbin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40kickstandsoft.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden