Re: NSArrayController & threads
Re: NSArrayController & threads
- Subject: Re: NSArrayController & threads
- From: Chris Meyer <email@hidden>
- Date: Tue, 30 Dec 2003 16:38:49 -0800
I've seen a similar problem in the Finder on Panther. It's annoying but
I haven't filed a bug in Radar yet because I haven't found a way to
reproduce it reliably... But if it is the same bug, it might be easier
to convince Apple to fix it.
On Dec 30, 2003, at 11:55 AM, Calum Robinson wrote:
I have an application that uses NSArrayController to manage a list of
NSMutableDictionaries that contain 3 key/value pairs (Revision, author
and message) for a version control system. The commit log is displayed
in a table showing the revision & author, with the message of the
selected revision from the table view being shown in a text field
below.
All was working well until I added asynchronous downloading of log
messages (there may be 1000's to fetch & display), so I had a separate
thread add items to the log message array as they arrive over the
network.
The problem is that it is impossible to select log messages in the
table - when you click on 1 row in the table, the previous one is
reselected for no apparent reason, but not all of the time. Even when
I set the NSArrayController to preserve selection, it is still very
difficult to select anything in the table view. Plus, when you try to
scroll down the table view, it automatically pops back up to make the
selection visible.
You can see from the sample code below that I am calling the
NSArraryController methods in the main thread, so this doesn't seem to
be an obvious thread-safety issue.
One way I have found to fix this is to bind the content of the table
view (and not just it's individual columns) to the NSArrayController's
arrangedObjects, which allows proper selection and scrolling in the
table view. However, the text view that displays the log message for
the selected row in the table view is never changed from the first
row.
I have reduced this down as much as I can, and you can download the
test project from my iDisk (36kb):
http://homepage.mac.com/calumr/ArrayTest.zip
If no-one can solve this for me then I'll file a bug, but ATM I think
it is more to do with my limited understanding of how the controller
API works.
Calum Robinson
http://homepage.mac.com/calumr
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.