Re: How to force NSTableView to stop editing a text cell?
Re: How to force NSTableView to stop editing a text cell?
- Subject: Re: How to force NSTableView to stop editing a text cell?
- From: Graham Cox <email@hidden>
- Date: Wed, 9 Apr 2008 23:35:06 +1000
I found a simple solution - just call -abortEditing before asking the
window to make the table 1stR. I sometimes forget to look in the
superclass for a solution, in this case NSControl has one. Seem OK?
- (void) textDidEndEditing:(NSNotification*) aNotification
{
// this overrides the standard behaviour so that ending text editing
does not select a new cell for editing
// Instead the delegate is called as normal but then the table is
made 1stR.
NSString* theString = [[aNotification object] string];
NSTableColumn* theColumn = [[self tableColumns] objectAtIndex:[self
editedColumn]];
[[self delegate] tableView:self setObjectValue:theString
forTableColumn:theColumn row:[self selectedRow]];
[self abortEditing]; //<---- added
[[self window] makeFirstResponder:self];
}
------
S.O.S.
On 9 Apr 2008, at 10:51 pm, Graham Cox wrote:
How can I force a text cell in NSTableView to stop editing? On 10.4
I could just tell the view's window to make the entire table the
first responder and that did the trick, but on 10.5 this no longer
works.
I'm trying to do this from within the textDidEndEditing:
notification method so that I can suppress the table behaviour that
goes to the next row and starts editing there - I just want the text
to end editing on typing return and the table view to go back to its
previous state - same row selected but no text being edited.
------
S.O.S.
_______________________________________________
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