开发者

Capturing undo/redo key events on NSTableView

I need to capture undo/redo key comman开发者_开发知识库ds 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?


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.

[NSWindowDelegate windowWillReturnUndoManager:]


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜