Reputation: 3919
By default, double-clicking triggers renaming in NSTableView.
How can I let double-clicking instead trigger my own custom code (such as opening the double-clicked file)?
And also: How can I let the renaming be like in Finder, where you first single click, and then click again and quickly move the mouse pointer away? That is how renaming gets triggered in the Finder. I want it like that in NSTableView.
Upvotes: 3
Views: 2743
Reputation: 22707
You must make the text cell uneditable in order for your table view to get a double-click action message.
Upvotes: 2
Reputation: 61228
According to the documentation, NSTableView has -setDoubleAction:. Clicking once to select a row, then clicking a text cell to edit behaves like the Finder by default (and neither this nor Finder have anything to do with moving the pointer quickly away - try it).
Click once to select, then click again to begin rename. Click twice (fast enough to be a double-click) and it handles the "double" action.
Upvotes: 8