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

Re: No validation with a bound NSTableView and custom NSFormatter


  • Subject: Re: No validation with a bound NSTableView and custom NSFormatter
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 01 May 2012 19:42:57 -0700

On May 1, 2012, at 19:20 , Ben Kennedy wrote:

> The issue I'm still having is that non-bound columns (i.e., those controlled by the latter two NSTableViewDataSource methods) are not enforcing validity when the attached formatter returns NO from getObjectValue:forString:errorDescription:.


I don't know that I've ever had to deal with this specific scenario, but examination of the documentation leads to the following observations:

1. You can implement a table view delegate that conforms to the NSTableViewDelegate protocol.

2. That's a sub-protocol of the NSControlTextEditingDelegate protocol.

3. That protocol has a method 'control:isValidObject:'.

4. The documentation of that method:

> https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSControlTextEditingDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSControlTextEditingDelegate


says this:

> "This method gives the delegate the opportunity to validate the contents of the control’s cell (or selected cell). In validating, the delegate should check the value in the object parameter and determine if it falls within a permissible range, has required attributes, accords with a given context, and so on. Examples of objects subject to such evaluations are an NSDate object that should not represent a future date or a monetary amount (represented by an NSNumber object) that exceeds a predetermined limit."

That seems like what you want, if you query the formatter directly from this delegate method.

Whether NSTableView has an automated mechanism for querying the formatter itself, I don't know, and I can't find any documentation that suggests it might.

I bet there's an easier answer staring us right in the face.


_______________________________________________

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: Ben Kennedy <email@hidden>
References: 
 >No validation with a bound NSTableView and custom NSFormatter (From: Ben Kennedy <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Quincey Morris <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Ben Kennedy <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Quincey Morris <email@hidden>)
 >Re: No validation with a bound NSTableView and custom NSFormatter (From: Ben Kennedy <email@hidden>)

  • Prev by Date: Re: No validation with a bound NSTableView and custom NSFormatter
  • Next by Date: Re: No validation with a bound NSTableView and custom NSFormatter
  • Previous by thread: Re: No validation with a bound NSTableView and custom NSFormatter
  • Next by thread: Re: No validation with a bound NSTableView and custom NSFormatter
  • Index(es):
    • Date
    • Thread