Re: Synchronized NSTableViews
Re: Synchronized NSTableViews
- Subject: Re: Synchronized NSTableViews
- From: James Bucanek <email@hidden>
- Date: Sat, 20 Jan 2007 14:24:34 -0700
David wrote on Saturday, January 20, 2007:
>Synchronizing the scrolling of this is easy. The problem is when you
>select a record in 4 for instance you need to have it appear as
>though that selection spans tables 4, 5, and 6. Columns in table 2
>and 3 must also span across each other. I am able to make it appear
>the selection spans across these tables by subclassing NSTableView
>and overriding highlightSelectionInClipRect and using my own datacell
>which overrides highlightColorWithFrame.
This approach seems hazardous, as you are subverting the relationship beween the selected rows in the table and what rows the table draw as selected.
Instead of subclassing NSTableView, I'd simply attach delegates to the tables and receive tableView:selectionDidChange: events. All it would have to do is broadcast the new selection to the other tables. You would probably have to first get the selection of the other table and check to see if the selection needs changing to avoid an infinite recursion, but other than that the solution should be simple.
>I have not started resizing of columns or drag and drop but was
>curious if anyone has attempted something similar or if someone can
>suggest any other approach that may be simpler and more robust.
Similar solution using these events: tableView:columnDidResize:, tableView:columnDidMove:, ...
--
James Bucanek
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden