Strange behaviour with NSTableView binded to NSArrayController with NSSet as content
Strange behaviour with NSTableView binded to NSArrayController with NSSet as content
- Subject: Strange behaviour with NSTableView binded to NSArrayController with NSSet as content
- From: Christian Ziegler <email@hidden>
- Date: Tue, 27 Oct 2009 19:27:40 +0100
Hi all!
I have a strange problem which I can't figure out.
I got an NSTableView binded to an NSArrayController (Values, Sort
Descriptors, Selection), which itself is binded to a class'
NSMutableSet via the ContentSet binding. The NSTableView is filled via
Drag & Drop or File/Open. For an initial insertion of data I set a
sortDescriptor, but if the user drags objects around in the
NSTableView I remove the sortDescriptors of the NSTableView by setting
it to nil.
Everything works fine until the user adds more files with no
sortDescriptors being set (e.g. the user d&d'ed objects before). If
the user adds objects (again d&d or File/Open, it does not matter)
they get added in an undefined order, which I guess is ok since the
Model uses an NSSet, but from that time on, moving objects around in
the NSTableView via D&D does not work anymore. The objects just stay
at the potition they were. Now if the users clicks on the TableView's
column to resort it (which is implemented by myself not via the
NSTableViewColumn option in IB) D&D works again. Well until he adds
files again.
Bottom line: Everytime Objects get added in a state when
sortDescriptors are nil (or empty), D&D does not work anymore.
I access and change the model only through the NSArrayController's
methods. I implemented the D&D via removing and inserting the objects
in the arrangedObjects attribute of the NSArrayController, using the
standard Methods (removeObjectAtArrangedObjectsIndex and so on).
I hope anybody got a clue what this could be about.
Thanks in advance,
Chris
P.S. The Modelclass which keeps the NSMutableSet implements the KVC-
Compliance Methods, if this is of any importance (My understanding is,
it is only a matter of performance).
_______________________________________________
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