• 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: Daniel Jalkut <email@hidden>
  • Date: Tue, 24 Jan 2006 09:07:47 -0500


On Jan 24, 2006, at 8:37 AM, Dan Price wrote:

It's not a one-off situation unfortunatly, and
changing the accessors for the ID to filter the value
will likely break other parts of the app.

You probably wouldn't risk too much by adding a *new* accessor, leaving the original attribute as-is.


And how would I set the menu to -1 (no selection) and
disable it for certain IDs? Looks like I'll have to go
back to my old glue code... :-(

How about adding a property to your model "allowsBlahSelection". Bind the "enabled" property of the popup to that key. In the allowsBlahSelection you can test whatever it is you need to test and return YES or NO.


And yes - there's definitely a fair amount of "glue code" in bindings programming. Don't let anybody tell you differently :)

But perhaps another possibility for your original filtering issue would be to subclass NSArrayController. Define a "SelectableBlahsController" that provides only the desired values. I've never done this but I bet the "Filtering Array" example on mmalc's page would help point you in the right direction:

http://homepage.mac.com/mmalc/CocoaExamples/FilteringController.zip

It would seem that this could be best for the longer term as it sounds like you'll be wanting to this kind of filtered array presentation in other parts of your UI.

Daniel

_______________________________________________
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


References: 
 >Re: Can bindings be set to ignore certain values? (From: Dan Price <email@hidden>)

  • Prev by Date: Re: Conceptual question
  • Next by Date: Re: NS .... lex/yacc ?
  • Previous by thread: Re: Can bindings be set to ignore certain values?
  • Next by thread: Problems trying to get simple Mail plugin working
  • Index(es):
    • Date
    • Thread