Re: How to end table cell editing by keyboard (return/enter)?
Re: How to end table cell editing by keyboard (return/enter)?
- Subject: Re: How to end table cell editing by keyboard (return/enter)?
- From: Ben Dougall <email@hidden>
- Date: Mon, 4 Jul 2005 13:00:40 +0100
On Monday, July 4, 2005, at 04:11 am, Ondra Cada wrote:
Joern,
On 3.7.2005, at 16:18, email@hidden wrote:
I have a NSTableView setup with a NSTableColumn which consists of the
default NSTextFieldCell. The table is populated using a
NSArrayController (bindings). I allow editing of the entries in the
column via double click and (in another case) sending
editColumn:row:withEvent:select: to the table view.
What I want: Editing a cell and pressing return ends the editing,
setting the selection to the edited entry. Best case: the
app/controller/whatever gets notified about this event.
The impossibility to do this cleanly is, far as I know, one of a
surprisingly small number of faults in the Cocoa-based GUI.
Of course, in a dynamic object system anything goes, albeit sometimes
kinda ugly way :)
The solution looks kind of like this (it's possible there's a better
one: this one used to be arguably the best available a few years ago
-- meantime API was improved, *perhaps* making this hack obsolete):
will these not work in this situation?:
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView
doCommandBySelector:(SEL)command
{
if( command == @selector(insertNewline:) )
and:
[theWindow endEditingFor:nil]
i just used those in a subclassed NSTextField to get end editing
(including removal of highlight and focus ring) on return press but
maybe the situation is different with the situation described above. i
don't know.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden