Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSTableView selectable but not editable

Trying to get an NSTableView in IB to be selectable but not editable. But de-selecting "Editable" for a column also removes the selecting capability.

Can someone tell me where I should insert this code to make it work (not working in app delegate or window controller) :

NSTextFieldCell *aCell = [tableColumn dataCell];
[aCell setEditable: NO];
[aCell setSelectable: YES];

BTW that table is updated by dictionary bindings, and the dictionary controller is set to not editable.

like image 507
yolo Avatar asked Feb 23 '23 03:02

yolo


2 Answers

Set the columns to Editable, but the individual cell behaviour to Selectable.

like image 93
yolo Avatar answered Mar 03 '23 21:03

yolo


I'd try implementing tableView:shouldEditTableColumn:row:in your NSTableViews delegate and return NO. See here.

like image 42
BinaryBucks Avatar answered Mar 03 '23 20:03

BinaryBucks