How to copy rows from an NSTableView

I have one NSTableView that only displays a string of numbers. I just want to copy these numbers using (cmd + copy) or right click. How can I achieve this feature in NSTableViews.

+3
source share
1 answer

By default, the edit menu (cut / copy / paste / etc.) is automatically turned on if the text in the tableView table is selected or edited, and the text field is in the responder chain.

Menu items with automatic activation work by looking at the responder chain. If the first responder responds to the selector to which the menu item is bound, the menu item is enabled. If the first responder does not respond to the selector of this menu item, the menu item is disabled.

You want the text box element in the cell / table view to be selected (you can enable / disable it in the interface builder), also make sure your text field accepts FirstResponder (can be called allowFirstResponder, I'm from memory)

0
source

Source: https://habr.com/ru/post/1765234/


All Articles