• 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: NSCell subclass editing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCell subclass editing


  • Subject: Re: NSCell subclass editing
  • From: tiennou <email@hidden>
  • Date: Wed, 3 Oct 2007 12:42:41 +0200

In drawInteriorWithFrame i call the drawInteriorWithFrame methods of sub-cells with appropriate coordinates.
As about tableView:setObjectValue delegate, you may return any object from objectValueForTableColumn method with any properties, and read ones in Cell's setObjectValue method.

I'm sorry I don't understand what you mean... ;-)
What I'm basically trying to achieve is that I want my delegate method tableView:setObjectValue called when the NSOpenPanel closes, so I'm not forced to use ugly hacks (like resorting to the Responder chain...).
Sorry I don't hear anything about setObjectValue delegate method of NSTableView. setObjectValue is a method of NSCell class. IMHO you should simply use your dataSource reference to "save" the
data you selected in NSOpenPanel into its internal structures (with its custom methods) and then update NSTableView....


Hmm, I'll try to explain what I mean :
Right now, when you're using default (eg NSTextFieldCell) cells, your tableview datasource recieve - tableView:setObjectValue:tableColumn:row when editing finishes, allowing the datasource to update itself (storing the new value in to whatever stuff you're using as datasource ;-)).
Trying to override this behavior in -[NSCell editWithFrame:inView:editor:delegate:event:] right now is a real pain, meaning that if I want my NSCell subclass to use something other than NSText for editing, (eg display an NSOpenPanel, or NSColorPanel) :
- I need to call my super implementation (which has the drawback that the text editor display for a short while before the panel covers it), setting the -[NSText string] to the NSOpenPanel result back in the NSOpenPanel selector called after the sheet is closed (whici is the value passed to the datasource in the end). This also means passing a color is impossible with this approach...
- Use private stuff inside NSTableView to make it call it's delegate with the correct object (which break the separation between a cell and its control, because now my cell will only work inside NSTableViews).


NSCell should be made editor-agnostic, by changing - [editWithFrame:...] into -[editWithFrame:InView:] (putting the current implementation in NSTextFieldCell, where it belongs), and - [endEditing:(NSText*)] into -[endEditing:(id) theObjectThatWillBePassedToTheDelegate], but that's my 2 cents...

Etienne Samson
_______________________________________________

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: NSCell subclass editing
      • From: Corbin Dunn <email@hidden>
References: 
 >NSCell subclass editing (From: tiennou <email@hidden>)
 >Re: NSCell subclass editing (From: Boris Remizov <email@hidden>)

  • Prev by Date: Re: Toolbar item with popup menu
  • Next by Date: Re: Nib & retainCount confusion
  • Previous by thread: Re: NSCell subclass editing
  • Next by thread: Re: NSCell subclass editing
  • Index(es):
    • Date
    • Thread