> On Apr 19, 2016, at 5:28 PM, Quincey Morris > <quinceymor...@rivergatesoftware.com> wrote: > > On Apr 19, 2016, at 16:11 , Richard Charles <rcharles...@gmail.com> wrote: >> >> 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.”. > > Is the text field bound to a NSObjectController, or how does it get/set its > value from/to the data model?
Yes, the text field is bound to an NSArrayController. > My memory is vague on this, but I think that obnoxious sheet comes from the > NSObjectController rather than the NSFormatter. I am not sure where the alert sheet comes from but I discovered it uses the responder chain. After much trial and error the following NSResponder override seems to work well in my NSTextField subclass. - (void)presentError:(NSError *)error modalForWindow:(NSWindow *)window delegate:(id)delegate didPresentSelector:(SEL)didPresentSelector contextInfo:(void *)contextInfo { NSBeep(); [self abortEditing]; [self.window makeFirstResponder:self]; } The default implementation of this method presents an error alert to the user as a document-modal sheet attached to the document window. Instead we simply beep, abort editing, and reset the text field for editing again. The documentation cautions against overriding this method but I could not find anything else that worked. --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