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: Corbin Dunn <email@hidden>
- Date: Tue, 10 Jan 2006 16:34:25 -0800
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:
This email sent to email@hidden