• 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
Re: Using control:didFailToFormatString:errorDescription:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Using control:didFailToFormatString:errorDescription:
      • From: Rohan Lloyd <email@hidden>
  • Prev by Date: Re: User input while reading document
  • Next by Date: Re: How to create a GUID?
  • Previous by thread: Using control:didFailToFormatString:errorDescription:
  • Next by thread: Re: Using control:didFailToFormatString:errorDescription:
  • Index(es):
    • Date
    • Thread