Re: Any tricks to dragging an NSTableView?
Re: Any tricks to dragging an NSTableView?
- Subject: Re: Any tricks to dragging an NSTableView?
- From: Andy Lee <email@hidden>
- Date: Thu, 20 Apr 2006 01:49:38 -0400
On Apr 20, 2006, at 12:52 AM, Scott Anguish wrote:
On Apr 19, 2006, at 11:59 PM, Sherm Pendley wrote:
Obviously, the order in which subviews of the table view would be
drawn is undefined, but wouldn't a Sketch-like app define its own -
drawRect: for its top-level canvas view, which would iterate
through and draw the table view and its siblings in a known order?
well, yes.
I'm not so sure, and here's why.
Since the table views are subviews of the canvas view, the default
display logic will still proceed to draw those subviews after the
canvas view's -drawRect: is finished. So even if the canvas view's -
drawRect: draws the tables in the right order, they will just draw
themselves again and mess up that order.
I suppose -drawRect: could send each subview a -setNeedsDisplay:NO
after drawing it. I don't actually know if that would work, but it
feels sketchy, if you'll pardon the pun.
Anyway...
But a sketch-like app wouldn't use views as the items in its
display list.
Views are a heavyweight object and just aren't suited to this use
(Avoid the Overuse of Views - View Programming Guide for Cocoa
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaViewsGuide/Optimizing/chapter_7_section_2.html#//apple_ref/doc/
uid/TP40002978-CH11-112116>)
...this is more to the point -- whether one really wants to use a
view at all. If, along with circles and squares, you want to have a
graphic object that looks and behaves like a table view, using an
actual table view seems awfully convenient. The performance cost of
doing so may or may not matter depending on the application. You'd
still have the z-ordering problem, though.
One workaround might be to put the table views in an offscreen
window. Your canvas view would draw the tables by copying regions
from that offscreen window -- or more precisely, your graphic-object
class would do this on request from the owning canvas view.
--Andy
_______________________________________________
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