• 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: Can bindings be set to ignore certain values?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can bindings be set to ignore certain values?


  • Subject: Re: Can bindings be set to ignore certain values?
  • From: Scott Anguish <email@hidden>
  • Date: Tue, 24 Jan 2006 02:15:53 -0500

I do agree with Daniel that the other option is probably easier.. :-) especially if it is a one-off situation.


(Oh,, BTW.. It's speculative, in that if I haven't actually tried it, I don't tend to say "blah is true". I hate being wrong. Especially here.)




On Jan 24, 2006, at 12:20 AM, Daniel Jalkut wrote:

You would have to write a custom subclass of NSValueTransformer:

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ ObjC_classic/Classes/NSValueTransformer.html

And then instantiate it in your application's runtime, and specify it as the transformer for your binding.

I'm not a pro at bindings, but I think it is speculative that you could easily get a value transformer to affect an entire array (and thus perhaps why Scott put a "might" in his comment).

If I was in your position I would probably just build whatever filtering is appropriate into the model object - or at some point in the path from the view to the model. If necessary, add a new property (and accessor) called "thingsThatShouldShowUpInPopupMenus" or whatever. Let that method call through to the real model and do the filtering. Declare the key as dependent on the "noisy" model key and let the bindings mechanisms handle the rest.

Daniel

On Jan 23, 2006, at 6:34 PM, Dan Price wrote:


--- Scott Anguish <email@hidden> wrote:

You might be able to do this with a ValueTransformer
that filters the
array, removing the items you don't want displayed.

Can this be done in IB? I'd appreciate some hints.



___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Can bindings be set to ignore certain values?
      • From: Dan Price <email@hidden>
References: 
 >Re: Can bindings be set to ignore certain values? (From: Dan Price <email@hidden>)
 >Re: Can bindings be set to ignore certain values? (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Re: invertrect, any cocoa versions suggested?
  • Next by Date: Re: Searching a controller's content
  • Previous by thread: Re: Can bindings be set to ignore certain values?
  • Next by thread: Re: Can bindings be set to ignore certain values?
  • Index(es):
    • Date
    • Thread