Handling List of Hardware Devices in NSTableView w/ Asynchronous Updates
Handling List of Hardware Devices in NSTableView w/ Asynchronous Updates
- Subject: Handling List of Hardware Devices in NSTableView w/ Asynchronous Updates
- From: Grant Erickson <email@hidden>
- Date: Wed, 01 Apr 2009 07:51:12 -0700
- Thread-topic: Handling List of Hardware Devices in NSTableView w/ Asynchronous Updates
I've a list of hardware devices in an NSTableView. The contents of the table
view are updated accordingly using the device model (C++) getters in
objectValueForTableColumn and using the device model setters in
setObjectValue.
However, the device model can also asynchronously create (sometimes
rapidly-order of tens to hundreds of milliseconds) updates for one of the
model values independently of the getter. To handle this, I currently have
the controller implement a delegate method for these asynchronous updates
and then do:
[mDeviceTable reloadData];
Unfortunately, this then causes the table to hit all the device getters for
all the devices and update all the columns even though only a single column
(and possibly row) has changed thereby creating needless bus traffic and
activity.
My first inclination is to create an array of dictionaries that act as a
cache for the device attributes, have the asynchronous delegate update the
appropriate key/value and then have reloadData update from there.
Is this the best or recommended approach? I'm only vaguely familiar with
Cocoa's KVC/KVO, but based on my understanding it also seems like a KVC/KVO
wrapper for the C++ device model might also work.
Thanks,
Grant
_______________________________________________
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