Re: NSTableView updating single cells
Re: NSTableView updating single cells
- Subject: Re: NSTableView updating single cells
- From: Nicolas Berloquin <email@hidden>
- Date: Wed, 5 May 2004 18:49:42 +0200
On 5 mai 04, at 18:08, matt neuburg wrote:
On Wed, 5 May 2004 11:02:39 +0200, Nicolas Berloquin
<email@hidden>
said:
I have an NSTableView with a datasource (no bindings).
The datasource is updated every second and most of the time, only a
couple cells per row need to be updated on screen.
So I'm looking for a way to tell the tableview or the colums the
equivallent of setNeedsDisplay: (I don't need real-time updating).
Right now, I resorted into calling reloadData, but this call is VERY
expensive (my app goes up to 60% cpu usage when that happens).
The NSTableView will only ask for information about the rows that are
actually showing, so if reloadData: is expensive then this must be due
to
your implementation of the data source callbacks. It is up to you to
make
sure that this code is lightweight. m.
mmm, maybe I wasn't very clear in my explaination (my english is not
too good).
Lets say all rows are showing.
But only certain cells need updating (data is different, has changed,
and the cell should be redrawn with the new data). If the data hasn't
changed, I'd prefere NOT to have the cells refetch the data and draw it
(this seems what takes all the cpu time when ALL the cells are redrawn
every second).
As for the datasource, I'm not doing anything fancy, I have an array
witn one entry per row, and inside the array, a dictionary with a key
per column identifier, so you can't really be much faster here.
What I'm saying is that if only a little percentage of the cells have
new data in them, calling reloadData and having the whole table draw is
slow.
But maybe this comes from the data inside the cells ?
Here's what I have:
- 8 texfields with simple text in them
- 4 NSImageCells with 16*16 icons (that show on/off states)
- 1 NSImageCell with a bigger image that gets scaled to the size of the
cell.
And there can be 50-100 rows.
_______________________________________________
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.