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: "email@hidden" <email@hidden>
- Date: Fri, 13 Nov 2009 16:19:26 +0000
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.
Would this and the fact that NSOutlineView is an NSTableView subclass tend to indicate that I am screwing up somewhere?
>
> corbin
>
>
>> This is to enable NSTableView rows to have one line of text that runs beneath several other cells.
>> Bindings are utilised.
>>
>> This works fine except, curiously, when an operation is undone.
>> In this case the cell only redraws within its initial cellFrame.
>> In other words, it doesn't redraw within the extended area as detailed in - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView detailed below.
>> If I click the table row redrawing occurs correctly.
>>
>> Tracing shows that the bindings are firing okay and that my code path is the same for do/undo.
>> All cellFrame rects look as expected.
>>
>> Is it to be presumed that there is different code path within NSCell following an undo?
>>
>> - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
>> {
>>
>> if (self.twoLine) {
>> if (self.displayOnSecondLine) {
>>
>> // draw text for line 2
>> cellFrame.size.height /= 2;
>> cellFrame.origin.y += cellFrame.size.height;
>>
>> // draw to edge of control ?
>> if (self.extendCell) {
>> cellFrame.size.width = [controlView frame].size.width - cellFrame.origin.x;
>> }
>> } else {
>>
>> // draw only on first line
>> cellFrame.size.height /= 2;
>> }
>> }
>>
>> [super drawInteriorWithFrame:cellFrame inView:controlView];
>> }
>>
>> Regards
>>
>> Jonathan Mitchell
>>
>> Developer
>> http://www.mugginsoft.com
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>>
>> 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
>
_______________________________________________
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