From 10ad22071d4891d22997d4a355b26eac1e0f481f Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Sun, 10 Sep 2000 15:01:15 +0000 Subject: [PATCH] Don't edit columns which are not editable git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7459 72102866-910b-0410-8b05-ffd578937521 --- Source/NSTableView.m | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Source/NSTableView.m b/Source/NSTableView.m index d334408ce..6594bb2b8 100644 --- a/Source/NSTableView.m +++ b/Source/NSTableView.m @@ -1426,6 +1426,7 @@ byExtendingSelection: (BOOL)flag NSPoint location = [theEvent locationInWindow]; NSTableColumn *tb; int clickCount; + BOOL shouldEdit; // // Pathological case -- ignore mouse down @@ -1765,20 +1766,32 @@ byExtendingSelection: (BOOL)flag if ([self isRowSelected: _clickedRow] == NO) return; - if ([_delegate respondsToSelector: - @selector(tableView:shouldEditTableColumn:row:)]) + tb = [_tableColumns objectAtIndex: _clickedColumn]; + + shouldEdit = YES; + + if ([tb isEditable] == NO) + { + shouldEdit = NO; + } + else if ([_delegate respondsToSelector: + @selector(tableView:shouldEditTableColumn:row:)]) { - tb = [_tableColumns objectAtIndex: _clickedColumn]; if ([_delegate tableView: self shouldEditTableColumn: tb row: _clickedRow] == NO) { - // Send double-action but don't edit - [self sendAction: _doubleAction to: _target]; - return; + shouldEdit = NO; } } + + if (shouldEdit == NO) + { + // Send double-action but don't edit + [self sendAction: _doubleAction to: _target]; + return; + } - // Delegate said its OK to edit column. Go on, do it. + // It is OK to edit column. Go on, do it. [self editColumn: _clickedColumn row: _clickedRow withEvent: theEvent select: NO]; }