PDA

View Full Version : How to end NSTextField's editing session programmaticaly?




HARDWARRIOR
Mar 14, 2009, 04:17 AM
Hi!
I have a table in my app. Each row has several text fields. For editing I use poping NSPanel, not NSTableView itself. I use bindings from NSTextFields values to NSArrayController first selected record.
After selecting a record in tableview and clicking edit button (or double clicking on record) editPanel shows up. Now if user edited on of textFields he must hit return or change focus in order that recently edit textField to commit editing to nsarraycontroller through bindings. So if user will open edit panel, change some textfield AND THEN CLICK ON CLOSE BUTTON OF THAT PANEL editing wont be commited. I can intercept that click on close button, but what code should I use to commit editing? Also is it possible for editing to commit in real-time, I mean while user typing can textfield update model through bindings?



kainjow
Mar 14, 2009, 10:50 AM
Try checking "Continuously Updates Value" in the Bindings inspector under Value.

HARDWARRIOR
Mar 14, 2009, 12:13 PM
Wow! That's awesome! Thanks a lot!