• 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: Modifying NSTableView cell data just prior to invoking field editor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying NSTableView cell data just prior to invoking field editor


  • Subject: Re: Modifying NSTableView cell data just prior to invoking field editor
  • From: "K. Darcy Otto" <email@hidden>
  • Date: Fri, 1 May 2009 07:28:32 -0700

Yes, I was inserting spaces to achieve a fixed-width indent; things are working much better now, thanks to your suggestion.

I tried overriding -titleRectForBounds in my NSTextViewCell subclass, but for some reason, it never gets called (not really sure why). What I ended up doing was overriding -drawInteriorWithFrame:inView:, which does get called, and allowed me to reposition the frame prior to calling super.

One problem I ran into is that i need to have a different position for the rect based on the row, but I had no way for the subclass of NSTextViewCell to know which table cell was being drawn. I solved this by creating a variable in the table that gets set with calls in the delegate to -tableView:willDisplayCell:forTableColumn:row:, and this variable can then be read in -drawInteriorWithFrame:inView:. Is there a better way to determine which table cell is getting drawn? Seems a bit kludgy.

Thanks for your help.

On 30-Apr-09, at 8:49 PM, Jim Correia wrote:

On Thu, Apr 30, 2009 at 11:38 PM, K. Darcy Otto <email@hidden> wrote:

Option 2: Moving the text displayed by the NSTableView to the right by some
way other than inserting spaces. This might be the best way, alleviating
the need for a custom field editor and editing the field editor text prior
to display. I'm not really sure how to do this though.

So you are inserted spaces into the value to achieve an fixed width indent?


Subclass NSTextFieldCell, and override -titleRectForBounds: to add
your left padding.

- Jim

_______________________________________________

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


  • Prev by Date: Re: Creating a custom hierarchical list view
  • Next by Date: Re: NSXMLParser frees itself on error?
  • Previous by thread: Re: Creating a custom hierarchical list view
  • Next by thread: Re: NSSavePanel runModalForDirectory, set name selection?
  • Index(es):
    • Date
    • Thread