Re: Can bindings be set to ignore certain values?
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