Re: NSCell subclass editing
Re: NSCell subclass editing
- Subject: Re: NSCell subclass editing
- From: Corbin Dunn <email@hidden>
- Date: Wed, 3 Oct 2007 09:51:35 -0700
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...
You *could* do this in a subclass of NSTableView. Simply make some
informal protocol and expect your cells to call it.
Have you logged a bug/feature request for this? Please do, if you want
to see things like this end up in AppKit.
corbin
_______________________________________________
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