• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTableView and NSTextFieldCell redraw oddness when undo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 07:15:23 -0800

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

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

  • Follow-Ups:
    • Re: NSTableView and NSTextFieldCell redraw oddness when undo
      • From: "email@hidden" <email@hidden>
References: 
 >NSTableView and NSTextFieldCell redraw oddness when undo (From: "email@hidden" <email@hidden>)

  • Prev by Date: NSTableView and NSTextFieldCell redraw oddness when undo
  • Next by Date: Printing panel issue
  • Previous by thread: NSTableView and NSTextFieldCell redraw oddness when undo
  • Next by thread: Re: NSTableView and NSTextFieldCell redraw oddness when undo
  • Index(es):
    • Date
    • Thread