捕获 NSTableView 上的撤消/重做按键事件
我需要在 NSTableView 中捕获撤消/重做关键命令并将其转发到托管对象上下文的撤消管理器。我尝试过覆盖 -keyDown,但这很难导航。我确实需要一个国际化的解决方案来解决这个问题,该解决方案不围绕使用命令键修饰符掩码检查“z”键。
有没有办法设置我的表格视图来查找标准的“撤消”键绑定?有什么想法吗?
I need to capture undo/redo key commands in an NSTableView and forward that down to a managed object context's undo manager. I have tried overriding -keyDown, but that's hard to navigate. I really need an internationalized solution to this problem that doesn't revolve around checking for the "z" key with the command key modifier mask.
Is there a way I can set up my tableview to look for the standard "undo" key binding? Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在包含 NSTableView 的窗口的委托中实现 windowWillReturnUndoManager。然后返回对象上下文的撤消管理器。然后您的表视图将能够接收这些事件。
Implement windowWillReturnUndoManager in the delegate of the window containing your NSTableView. Then return your object context's undo manager there. Then your table view will be able to receive those events.
您通常在 Cocoa 应用程序中使用 NSUndoManager 来处理撤消/重做事件。有关详细信息,请参阅 http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html
You generally use NSUndoManager in Cocoa apps for handling Undo/Redo events. For more information, refer to http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html