Re: NSCell with Embedded NSView
Re: NSCell with Embedded NSView
- Subject: Re: NSCell with Embedded NSView
- From: Ryan Britton <email@hidden>
- Date: Thu, 6 Apr 2006 09:32:59 -0700
Take a look at this if you haven't already. It should give you some
idea of an approach that works.
http://www.cocoadev.com/index.pl?NSViewInNSTableView
On Apr 6, 2006, at 8:41 AM, Mike Rossetti wrote:
Folks,
I'd appreciate any hints and suggestions about how to properly draw
an NSView within an NSCell in an NSTableView. I _almost_ have it
working. The problem I am struggling with is that only the cell in
the very last row is being drawn properly. The crux of the matter
is that I am trying to use a 'floating' view for rendering the
contents of each cell in the single column in the table. (I need
to use this view because the data being shown is complex and does
not lend itself to composition in columns: it's a two-line
presentation where both lines do not line up column-wise.)
The floating view approach saves having to have, potentially, tens
of thousands of subviews, one for each row. Unfortunately, trying
to draw the view in the cell's drawWithFrame:
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView*)
controlView
{
if ([cellView superview] != controlView)
[controlView addSubview: cellView];
[cellView setFrame: cellFrame];
[cellView display];
}
results in recursion:
#0 0x0021d124 in -[MySpecialView display] at MySpecialView.mm:40
#1 0x0021cf10 in -[MySpecialCell drawWithFrame:inView:] at
MySpecialCell.mm:68
#2 0x9372d5ec in -[NSTableView _drawContentsAtRow:column:clipRect:]
#3 0x9372ce78 in -[NSTableView drawRow:clipRect:]
#4 0x9372cc34 in -[NSTableView drawRowIndexes:clipRect:]
#5 0x9372c2bc in -[NSTableView drawRect:]
#6 0x936c0e78 in -[NSView _drawRect:clip:]
#7 0x936c0438 in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#8 0x936bfa00 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisib
leRectForView:topView:]
#9 0x936b9674 in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#10 0x936ae968 in -[NSView displayIfNeeded]
-- Here we go again
#11 0x0021d17c in -[MySpecialView display] at MySpecialView.mm:43
#12 0x0021cf10 in -[MySpecialCell drawWithFrame:inView:] at
MySpecialCell.mm:68
#13 0x9372d5ec in -[NSTableView _drawContentsAtRow:column:clipRect:]
#14 0x9372ce78 in -[NSTableView drawRow:clipRect:]
#15 0x9372cc34 in -[NSTableView drawRowIndexes:clipRect:]
#16 0x9372c2bc in -[NSTableView drawRect:]
#17 0x936c0e78 in -[NSView _drawRect:clip:]
#18 0x936c0438 in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
#19 0x936bfa00 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisib
leRectForView:topView:]
#20 0x936b9674 in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#21 0x936ae968 in -[NSView displayIfNeeded]
-- Here we go again
#22 0x0021d17c in -[MySpecialView display] at MySpecialView.mm:43
#23 0x0021cf10 in -[MySpecialCell drawWithFrame:inView:] at
MySpecialCell.mm:68
#24 0x9372d5ec in -[NSTableView _drawContentsAtRow:column:clipRect:]
#25 0x9372ce78 in -[NSTableView drawRow:clipRect:]
#26 0x9372cc34 in -[NSTableView drawRowIndexes:clipRect:]
#27 0x9372c2bc in -[NSTableView drawRect:]
#28 0x936c0e78 in -[NSView _drawRect:clip:]
#29 0x936c0438 in -[NSView
_recursiveDisplayAllDirtyWithLockFocus:visRect:]
What is the recommended way to draw a floating NSView in response
to a NSCell being redrawn?
Thanks,
Mike
_______________________________________________
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
_______________________________________________
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