I have a subclassed NSTextFieldCell to create a cell that draws outside of it's 
frame.
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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to