Re: NSTextField & Hidden Binding Problem
Re: NSTextField & Hidden Binding Problem
- Subject: Re: NSTextField & Hidden Binding Problem
- From: Matt Neuburg <email@hidden>
- Date: Thu, 16 Nov 2006 15:40:27 -0800
- Thread-topic: NSTextField & Hidden Binding Problem
On or about 11/16/06 12:28 PM, thus spake "Thaddeus Cooper"
<email@hidden>:
> Matt --
>
> That's kind of what I thought -- however, that doesn't really get to the heart
> of the problem. The bindings for the two TextFields look like this:
>
> Label
> -------
> hidden
> Bind to: TestWizard_AppDelegate
> Model Key Path: customSMTPServerSelected
> Value Transformer: NSNegateBoolean
Right, it is bound to TestWizard_AppDelegate - but that's not what's
changing when the user chooses from the popup menu, is it? What's changing
is the SMTP Servers Array Controller. There's no connection between the two
(you have not bound from one to the other as far as I can see), so your
logic is in the wrong place. Your brain has two halves and neither knows
what the other is doing.
One simple way to fix this is for TestWizard_AppDelegate to observe the
selection in SMTP Servers Array Controller. When the selection changes,
TestWizard_AppDelegate is notified and should change a key-value-observable
ivar called customSMTPServerSelected (in a key-value-observable way). I'm
sending you (separately) an example project that demonstrates this approach.
There are many other possible approaches. The logic could all be in SMTP
Servers Array Controller, with the fields' "hidden" binding bound to it as
well. Or I suppose the "hidden" could be bound directly to the array
controller's selectionIndex, and mediated through an NSValueTransformer
containing the logic.
m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
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