Re: Updating a cell in NSTableView - it just will not draw!
Re: Updating a cell in NSTableView - it just will not draw!
- Subject: Re: Updating a cell in NSTableView - it just will not draw!
- From: Jens Alfke <email@hidden>
- Date: Sun, 20 Apr 2008 22:24:35 -0700
On 20 Apr '08, at 9:33 PM, Graham Cox wrote:
The problem I'm having is that when the menu is used to update the
cell in the table view, I just cannot get the darn thing to redraw.
At all. (at least until after the menu tracking returns and it goes
away). I've tried:
Remember, a table view doesn't have a unique NSCell object per table
cell; instead the same cell object is used to draw every table cell in
a column. So changing the cell's value yourself isn't going to affect
what's shown in the table. The value stored in the cell when it's
drawn in the table is the result of the dataSource's
objectValueForTableColumn: method.
So it sounds like what's happening is that your fake-menu, during
mouse tracking, hasn't yet updated the data model that's acting as the
table's data source. If so, the table cell isn't going to change its
appearance. You either have to stuff a new value into the data model
during tracking, or play games with the data source's
objectValueForTableColumn: method to make it return the interim value
when the right row/column is requested.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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