开发者

NSTableView handling edititng cells correctly

I have an NSTableView working correctly except when I'm editing one of the table items. If the user is still in edit mode, and it presses the Sheet OK button, the tableiew doesn't update.

How do I开发者_运维问答 force the tableview to commit the changes when the user press the ok button (closesheet).

Also, how do I handle the ESC Key to cancel the editing?

Sorry if the questions looks absurd, but I've been only on developing on Mac for a month.


You should be able to call [sheet makeFirstResponder:sheet], where sheet is the sheet you are about to close. That will switch first responder status away from the text field, which will cause it to commit the in-progress edit.


I had the very same problem: How to add data from an NSTextField to a Core Data Attribute without having to press Return or Tab after editing the TextField?

There seem to be different solutions. If you use bindings to connect the NSTextField of your edit sheet to the ArrayController, you could check „continously update value“ in the TextFields value binding in Interface Builder.

Other solutions are explained very well in this blogpost at Red Sweater Blog: http://www.red-sweater.com/blog/229/stay-responsive

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜