如何从NSTableView复制行 [英] how to copy rows from NSTableView

查看:224
本文介绍了如何从NSTableView复制行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个NSTableView,它只显示一行数字。我只是想使用(cmd +复制)或右键点击复制这些数字。如何在NSTableViews中实现此功能。

I have one NSTableView, Which displays just the row of numbers. I just want to copy those numbers using (cmd+copy) or right click copy. How can I achieve this feature in NSTableViews.

推荐答案

默认情况下,编辑菜单(剪切/复制/粘贴/自动启用,前提是tableView行中的文本是可选择或可编辑的,并且所讨论的文本字段位于响应程序链中。

By default, the edit menu (cut/copy/paste/etc) is auto-enabled, provided the text in your tableView row is selectable or editable, and the text field in question is in the responder chain.

自动启用的菜单项通过查看响应者链来工作。如果第一响应者响应菜单项所绑定的选择器,则菜单项被启用。如果第一个响应者没有响应给定菜单项的选择器,则禁用菜单项

The auto-enabled menu items work by looking at the responder chain. If the 1st responder responds to the selector that the menu item is tied to, the menu item is enabled. If the 1st responder doesn't respond to the selector of a given menu item, the menu item is disabled

您需要确保您的表单元格/视图是可选择的(您可以在界面构建器中打开/关闭),还要确保您的文本字段acceptedFirstResponder(可能被称为allowedFirstResponder,我将按内存)

You'll want to make sure the text field element in your table cell/view is selectable (you can turn this on/off in interface builder), also make sure your text field acceptsFirstResponder (might be called allowsFirstResponder, I'm going by memory)

这篇关于如何从NSTableView复制行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆