No Alert, Discard Change, & Beep
No Alert, Discard Change, & Beep
- Subject: No Alert, Discard Change, & Beep
- From: Richard Charles <email@hidden>
- Date: Tue, 19 Apr 2016 17:11:03 -0600
I have a NSTextField with a NSFormatter. When the user enters an incorrect value an alert sheet drops down from the document window stating “Please provide a valid value.”. The alert display two buttons: "Discard Change" and “OK”.
I would like have no alert sheet but rather discard the change and beep. You can see this behavior in some inspector text fields of Apple Productivity Apps (Numbers, Pages, etc).
A NSTextFieldDelegate method has been implemented like so.
- (BOOL)control:(NSControl *)control didFailToFormatString:(NSString *)string errorDescription:(NSString *)error
{
NSBeep();
return NO;
}
This gives a beep but how is the alert sheet suppressed and the change discarded?
Does anyone know how to do this?
--Richard Charles
_______________________________________________
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