• 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 validation with a bound NSTableView and custom NSFormatter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No validation with a bound NSTableView and custom NSFormatter


  • Subject: No validation with a bound NSTableView and custom NSFormatter
  • From: Ben Kennedy <email@hidden>
  • Date: Tue, 01 May 2012 14:23:38 -0700

Hi all,

I have an NSTableView whose data source is bound to an NSArrayController.  To one of its columns (displaying a custom type) I have attached a custom NSFormatter subclass.  The NSFormatter correctly returns NO from getObjectValue:forString:error: if the supplied string is not acceptable.  Despite this, however, validation is not enforced; when tabbing out of the field, the table view carries on and just assigns a null value to the corresponding property.

Even when I implement control:didFailToFormatString:errorDescription: in the NSTableView's delegate, an invalid null value is nevertheless accepted and focus moves to the next responder, despite returning NO.

My current implementation has been using an in-memory (transient) CoreData stack, but I have pared that back to simply use NSArrayController in "class" mode and behaviour is the same.

The modelled property in question is a custom class (not a plist-compliant primitive, hence in part the need for a custom NSFormatter); however, two-way behaviour in the NSTableView works fine except for the lack of validation.

I must be missing something fundamentally obvious, but I can't figure out where to approach the fix.  Enlightenment would be appreciated.

thanks,

-ben

--
Ben Kennedy, chief magician
Zygoat Creative Technical Services
http://www.zygoat.ca


_______________________________________________

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 validation with a bound NSTableView and custom NSFormatter
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Minimal document-based app
  • Next by Date: Re: Modal-loop Event-handling question
  • Previous by thread: Re: Modal-loop Event-handling question
  • Next by thread: Re: No validation with a bound NSTableView and custom NSFormatter
  • Index(es):
    • Date
    • Thread