NSOutlineView loses selection, but it's NSTreeController does not
NSOutlineView loses selection, but it's NSTreeController does not
- Subject: NSOutlineView loses selection, but it's NSTreeController does not
- From: "Doug Knowles" <email@hidden>
- Date: Mon, 24 Mar 2008 11:19:56 -0400
Hi, all,
My application has an outline view that is used to select filters on a
companion table view by selecting nodes in the outline. The outline also
adjusts itself to the content of the table, which runs the risk of some
interesting feedback loops. (It's hard to believe how long a Mac Pro can
take to overflow a stack...)
Anyway, I have carefully managed the interactions so that the content and
selections of the views do not change unnecessarily, and it's mostly working
for an edge case that has me stumped.
If I select a certain node in the tree, the code sets a filter predicate on
the table view's controller, and the table view content adjusts accordingly.
As a result of the change in the table view content, most or all of the
siblings of the selected tree node are removed. (It sounds weird, but it
makes sense in this case. I hope.) I am very careful to edit the tree
controller's content, not rebuild it, so the actual tree node object for the
selected node is unaffected.
The problem is that, in limited cases, the selected node becomes deselected
in the tree, even though there are no selection will/did change
notifications, and the NSTreeController still thinks the node is selected
(according to -[NSTreeController selectedNodes]), even though the outline
view does not (visually and per -[NSTableView selectedRowIndexes], which
NSOutlineView inherits). FWIW, the index path of the selected node does not
change in the case that breaks.
The inconsistency in the selection information between the view and the
controller have me stumped. I'm going to try to work around this by trying
to re-apply the selection after I set the filter, but I'd really rather get
to the bottom of it.
Any ideas welcome, as always.
TIA,
Doug K;
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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