NSTableView how to click anywhere in a cell to edit text?

I have a very simple NSTableView connected via NSArrayController and bindings to my model. I would like to slightly change the behavior of the view by double-clicking to edit. It seems that the default behavior when double-clicking on a cell edit is to open the cell for editing only when the click occurs on the location of the text inside the cell (see below).

I would like to change the behavior so that double-clicking anywhere in the cell triggers editing (the green icon in the image below). Any ideas? Perhaps I was looking for the wrong conditions, but I could not find anything about it.

enter image description here

+7
source share
1 answer

Subclass NSTextFieldCell and override -hitTestForEvent: inRect: ofView: return NSCellHitEditableTextArea regardless of where the mouse click occurred.

+2
source

All Articles