Re: Using control:didFailToFormatString:errorDescription:
Re: Using control:didFailToFormatString:errorDescription:
- Subject: Re: Using control:didFailToFormatString:errorDescription:
- From: Matt Neuburg <email@hidden>
- Date: Mon, 08 Sep 2008 07:48:59 -0700
- Thread-topic: Using control:didFailToFormatString:errorDescription:
On Mon, 8 Sep 2008 11:23:30 +1000, Rohan Lloyd <email@hidden> said:
>I don't like the vague "Format Error" and want to display my own
>message, so I've written my own
>control:didFailToFormatString:errorDescription: method (In my
>NSWindowController subclass), and set the text field delegate to point
>at it.
>
>- (BOOL)control: (NSControl*)control didFailToFormatString:
>(NSString*)str errorDescription: (NSString*)errDescription
>{
> NSError *error = [NSError errorWithDomain: NSCocoaErrorDomain
>code: NSFormattingError userInfo: nil]; // Add custom description later
> [control presentError: error modalForWindow: [self window]
> delegate: nil
> didPresentSelector: nil
> contextInfo: nil];
>
> return YES;
>}
First thing's first. Documentation says return value should be:
> Return Value
> YES if the value in the string parameter should be accepted as is; otherwise,
> NO if the value in the parameter should be rejected.
If you don't like the string, you should not be returning YES. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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