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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to