Correct way to commit pending text field edits?

2008-07-24 Thread Graham Cox
I have a window with a bunch of text fields. I also have an Apply button which takes the current settings and applies them to the data model. If I have edited text in a field but not hit return or tab or anything else that triggers target/action, the edit is ignored. So I need a way to

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Ken Ferry
Hi Graham, Try -[NSControl validateEditing]. Validation sets the object value of the cell to the current contents of the cell's editor (the NSText object used for editing), storing it as a simple NSString or an attributed string object based on the attributes of the editor. -Ken On Thu, Jul

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Graham Cox
I should mention I'm not using Core Data - by data model I mean my own d/m code. Mmmm, coffee... now there's a thought. Graham On 25 Jul 2008, at 12:30 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Apologies for the off-list reply, work email addy.. Try [managedObjectContext

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Joel Norvell
Graham Cox wrote: I need a way to commit ... pending edits as part of my response to the Apply button. I don't know that this is the correct way, but there is a built-in mechanism that will do what you want: If you were to makeFirstResponder nil for the window containing the text field,

Re: Correct way to commit pending text field edits?

2008-07-24 Thread chaitanya pandit
You need to call this on the NSTextField's cell: setSendsActionOnEndEditing:YES Hope it helps. -Chaitanya On 24-Jul-08, at 10:23 PM, Graham Cox wrote: I have a window with a bunch of text fields. I also have an Apply button which takes the current settings and applies them to the data

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Ken Thomases
On Jul 24, 2008, at 9:23 PM, Graham Cox wrote: I have a window with a bunch of text fields. I also have an Apply button which takes the current settings and applies them to the data model. If I have edited text in a field but not hit return or tab or anything else that triggers

Re: Correct way to commit pending text field edits?

2008-07-24 Thread Joel Norvell
chaitanya pandit wrote: You need to call this on the NSTextField's cell: setSendsActionOnEndEditing:YES sendsActionOnEndEditing appears to be ON by default. And it doesn't affect pending edits anyway. The problem is how to cause textDidEndEditing to fire. Hence my suggestion to