Re: NSTableView and NSTextFieldCell redraw oddness when undo
Re: NSTableView and NSTextFieldCell redraw oddness when undo
- Subject: Re: NSTableView and NSTextFieldCell redraw oddness when undo
- From: Corbin Dunn <email@hidden>
- Date: Fri, 13 Nov 2009 09:02:09 -0800
On Nov 13, 2009, at 8:19 AM, email@hidden wrote:
>
> On 13 Nov 2009, at 15:15, Corbin Dunn wrote:
>
>>
>> On Nov 13, 2009, at 6:35 AM, email@hidden wrote:
>>
>>> I have a subclassed NSTextFieldCell to create a cell that draws outside of it's frame.
>>
>> All the logic in tableview redraws things based on -frameOfCellAtColumn:row:. Things will frequently not get redrawn if you draw outside of those bounds.
>>
>> I recommend using a "full width" cell. See the AppKit release notes for 10.5
> Unfortunately this won't work in this situation as my custom cell is only drawing over the last half of the table width.
>
> I looked -frameOfCellAtColumn:row: but overriding it seems impracticable.
>
> It seems very weird that the problem pops up following an undo (it is a coredata app though...).
> Surely the NSTableColumn + NSCell won't know about the undo?
>
> I use the same cell subclass in an NSOutlineView of the same data and it works fine.
It works fine purely by chance! Plus, there are probably some cases where it doesn't update properly (and you just haven't noticed yet). If the table needs to redraw cell X at column Y, it will mark the area dirty via -frameOfCellAtColumn:Y row:X.
> Would this and the fact that NSOutlineView is an NSTableView subclass tend to indicate that I am screwing up somewhere?
The error is having the cell draw outside of its given bounds. You need to change that (or else do the invalidation yourself, which will be difficult to get correct in all cases, unless you override frameOfCellAtColumn:row:. Simply adding a -setNeedsDisplay:YES to redraw everything is bad for performance).
--corbin
_______________________________________________
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