0

I have an NSArrayController hooked up to an NSManagedObjectContext. Additionally, I have an NSTableView whose Content and Selection Indexes are bound to said NSArrayController.

Objects are constantly being added to the context in the background at a rate of 0.2 ~ 1.0 seconds per object. Making a single selection works fine, as is quickly selecting a handful of rows very quickly. However, if I'm in the middle of making a drag-select and an object gets added to the context, my selection indexes reset to their pre-mouse-down state.

How do I avoid this and ensure that, for the duration of my mouse-down, my selection is preserved despite new objects getting added to the context?

cacau
  • 3,606
  • 3
  • 21
  • 42
Anonymous
  • 1,750
  • 3
  • 16
  • 21

1 Answers1

1

Not sure it's a great idea to modify the NSTableView contents/the NSArray at all while a drag is in progress.

I'd rather consider buffering the new elements somewhere until the drag is complete and add them in one go after the drag was successfully accepted (or rejected).

Jay
  • 6,572
  • 3
  • 37
  • 65
  • This is for an on-the-fly log viewer, where live content is preferable. – Anonymous Aug 03 '14 at 19:27
  • Still - the semantics of *live* are debatable. Can't imagine any user complaining about not getting updates during the couple seconds a drag takes place. – Jay Aug 05 '14 at 18:25