Re: Selectable text in NSTableView?


Alex Zavatone
 

Wild guess, but what about the “can” methods.

In the headers is there any hidden secret docs hat might help?

On May 3, 2019, at 4:52 PM, Jens Alfke <jens@...> wrote:

I’ve got a view-based NSTableView that uses NSTextFields. I’d like to be able to select text in some of the columns, mostly so it can be copied to the pasteboard.

If I set the “selectable” property of the NSTextField, nothing happens.
If I set the “editable” property, I can select text … but the text field immediately becomes editable when the row is clicked to select it (i.e. its background changes to white and a focus ring is drawn around it.)

I’d prefer to have the field become editable on a second click, after selecting the row. But I can’t think of a clean way of doing this without a bunch of gnarly AppKit subclassing and method-overriding. Any suggestions?

—Jens

PS: This is *MAC OS*, not iOS.

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.