From 8bf2118b6e0d5d3cf542fdafbf148f1e22aa8540 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 3 Jun 2013 15:36:59 -0700 Subject: [PATCH] Fixed: selection in a tableView without column Previously it was possible to select rows in a CPTableView even if there wasn't columns. It was also possible to make a drag/drop. This PR fixes theses both problems. --- AppKit/CPTableView.j | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AppKit/CPTableView.j b/AppKit/CPTableView.j index 43cc09c79..6f9f32634 100644 --- a/AppKit/CPTableView.j +++ b/AppKit/CPTableView.j @@ -1273,7 +1273,8 @@ NOT YET IMPLEMENTED - (void)selectRowIndexes:(CPIndexSet)rows byExtendingSelection:(BOOL)shouldExtendSelection { if ([rows isEqualToIndexSet:_selectedRowIndexes] || - (([rows firstIndex] != CPNotFound && [rows firstIndex] < 0) || [rows lastIndex] >= [self numberOfRows])) + (([rows firstIndex] != CPNotFound && [rows firstIndex] < 0) || [rows lastIndex] >= [self numberOfRows]) || + [self numberOfColumns] <= 0) return; // We deselect all columns when selecting rows. @@ -3071,7 +3072,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad */ - (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes atPoint:(CGPoint)mouseDownPoint { - return [rowIndexes count] > 0 && [self numberOfRows] > 0; + return [rowIndexes count] > 0 && [self numberOfRows] > 0 && [self numberOfColumns] > 0; } /*!