Re: NSTableView "sometimes" doesn't repaint on reloadData:?
Re: NSTableView "sometimes" doesn't repaint on reloadData:?
- Subject: Re: NSTableView "sometimes" doesn't repaint on reloadData:?
- From: marc hoffman <email@hidden>
- Date: Sun, 31 Aug 2008 01:30:07 +0200
Michael,
thanx for the extensive reply.
any idea what might be happening? i mean, obviously the call to
reloadData:
takes fine, else if the table had - say - 3 rows before, it would
not know
to paint row five when i click it, right?
That's actually not obvious at all. You must remember that NSTableView
stores absolutely no data whatsoever internally. Whenever it needs to
know anything about the data that it displays, it asks your data
source. It does *not* only query your data source when you send it a
-reloadData.
right - but it wouldn't constantly requery for the row count, right?
so if i tell it "you got 3 rows" and then later, when more rows get
added, the reloadData call fails, the view would stll assume it has
three rows only. those rows would redraw anew/correct when touched,
but clicking int empty space" would not draw row #5?
(Note that there is no colon on this method's name, as it
takes no parameters.)
yes, my apologies; was referring to the method named from memory ;)
It will also query your data source every time
it needs to redraw, perform hit testing, or do anything else which
requires knowing what it displays.
So then, having the -reloadData call not do anything would explain
everything perfectly. It does nothing, so nothing happens. Then later
on you click. At this point, the table view does end up querying your
data source, which then tells it about the extra rows, and it
dutifully displays them. Since you've somehow failed to tell it about
those new rows earlier, odd things can happen like having the new data
only be partially displayed.
So then the question is, why does this -reloadData call fail? The most
obvious reason would be that its target is nil. In any case, step
through the code in question in the debugger, and hopefully the reason
shall be revealed.
problem is, i can't really foresee when this happens, s it's tricky to
step thru. sometimes i can type bac and forth in my search box wildly,
and the view adjusts every time. sometimes i type 3 chars and it stops
updating. also, even if it has stopped updating once, it might work
again the next time - so i' ruling out that my reference to the view
suddenly gets nil'ed, but then magically reset back to good :(.
anyways, i'll keep digging and add more debug messages. just wanted to
make sure i wasn't missing anything obvious like a secret
repaintAfterIAskedYouToReload method i had to call that wasn't
mentioned in the docs ;-)
thanx for your help,
marc
_______________________________________________
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