Core Data: Forcing update of NSTableView bound to an NSArrayController
Core Data: Forcing update of NSTableView bound to an NSArrayController
- Subject: Core Data: Forcing update of NSTableView bound to an NSArrayController
- From: Bill Coleman <email@hidden>
- Date: Tue, 8 Aug 2006 22:35:48 -0400
I previously had asked about performing a document-modal operation. I
had tried using NSThreads, but due to the complex multi-threading
issues, I've taken the advice of Jakob Olesen and am using what he
termed a tail-call recursion using
performSelector:withObject:afterDelay:.
This works quite well in creating a document-modal operation, my only
complaint is that it pauses importing or exporting while you hold a
menu down. I can live with that - kind of reminds me of old Classic
MacOS applications that processed on Idle events.
When the import operation finishes, I do a number of calls to attempt
to reposition the NSTableView to show the last item in the table.
However, the NSTableView doesn't appear to recognize all the records
I've imported until sometime after this, because the scroll position
is still at the top. Or if a few records are recognized in the middle
of the import, it scrolls to the end of the few it recognized.
Here's the code sequence after the import:
[self endProgressSheet]; // puts away the document-modal sheet
[arrayController rearrangeObjects];
[tableView reloadData];
[tableView scrollRowToVisible: [ [arrayController arrangedObjects]
count] - 1];
I've noticed that if I include the [arrayController addObject:] call
during my import, the NSTableView seems to keep up with the changes
as I go, although it somehow messes up the putting away of the sheet
at the end. Several responders indicated I shouldn't do that, since
the array controller is bound to the managed context.
So, how to I force the table to update at the end?
Bill Coleman, AA4LR, PP-ASEL Mail: email@hidden
Quote: "Not within a thousand years will man ever fly!"
-- Wilbur Wright, 1901
Bill Coleman, AA4LR, PP-ASEL Mail: email@hidden
Quote: "Boot, you transistorized tormentor! Boot!"
-- Archibald Asparagus, VeggieTales
_______________________________________________
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