Re: Problem with bound text field in accessory panel
Re: Problem with bound text field in accessory panel
- Subject: Re: Problem with bound text field in accessory panel
- From: Gideon King <email@hidden>
- Date: Thu, 12 May 2011 13:20:19 +1000
Thanks for the suggestions. I have found a solution. I make my file's owner the text field's delegate, and then implement the following:
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command {
if (command == @selector(insertNewline:)) {
[[control window] makeFirstResponder:nil];
[[control window] performSelector:@selector(ok:) withObject:self afterDelay:0];
return YES;
}
return NO;
}
Regards
Gideon
On 12/05/2011, at 12:47 PM, Kyle Sluder wrote:
> On Wed, May 11, 2011 at 6:26 PM, Gideon King <email@hidden> wrote:
>> Hi, I have a text field which is used in a save panel accessory when exporting files from my program. It is bound to the user defaults, and has continuous updating of values turned on so that if the user presses Return to complete the save operation, I still have the current value even though the text field end editing is bypassed.
>
> The better way to do this might be to call -commitEditing on the user
> defaults controller in your panel delegate's -windowWillClose:
> implementation.
>
> --Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden