• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
No Alert, Discard Change, & Beep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: No Alert, Discard Change, & Beep
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: How to make an app launch on login?
  • Next by Date: Re: BOOL parameter passed as nil object
  • Previous by thread: Re: How to make an app launch on login?
  • Next by thread: Re: No Alert, Discard Change, & Beep
  • Index(es):
    • Date
    • Thread