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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to