NSTableView correctly handles cells

I have an NSTableView that works correctly, unless I edit one of the elements in a table. If the user is still in edit mode and clicks the "Sheet OK" button, the table is not updated.

How to make tableview commit changes when the user clicks the ok button (close).

Also, how can I process an ESC key to cancel editing?

Sorry if the questions seem absurd, but I only deal with Mac development for a month.

+4
source share
2 answers

You can call [sheet makeFirstResponder:sheet] , where sheet is the sheet you want to close. This will disable the status of the first responder far from the text field, which will lead to its fixation in the editing process.

+3
source

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

There seem to be different solutions. If you use bindings to connect the NSTextField of your edit sheet to an ArrayController, you can check the "constantly update value" in the value binding of TextFields in Interface Builder.

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

+1
source

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


All Articles