Radio button group and binding "enabled" of other GUI elements
Radio button group and binding "enabled" of other GUI elements
- Subject: Radio button group and binding "enabled" of other GUI elements
- From: Kaspar Fischer <email@hidden>
- Date: Fri, 23 Sep 2005 11:13:14 +0200
Hi all,
Given a group of 3 radio buttons and, in addition, three
text fields, what is the best way to enable text field 1
if and only if radio button 1 is selected (and the same
for the other fields)?
More precisely: I have there radio buttons
o A
o B
o C
and three text fields (just to illustrate the problem),
and I want that the text field corresponding to A is
enabled iff radio button A is selected and that the
text field for B is enabled iff B is selected and so on.
With only *two* buttons and text fields I would simply
use a NSObjectController with a key "isASelected" and
then bind the selectedIndex of the radio button's NSMatrix
to this "isASelected"; I can then bind the enabled of
text field A to "isASelected" and the enabled of text field
B to "isASelected" with value transformer NSNegateBoolean.
Any suggestions to achieve the same for more than two
buttons and text fields?
Thanks,
Kaspar
P.S. One way I see (which is not so elegant as it needs
coding) is to write value transformers "Is0", "Is1",
and "Is2" which return true if and only if the number
is 0 (or 1, or 2 respectively). I could then again use
an NSObjectController with a key "selectedIndex" and
bind the enabled of the text fields using the Is0/1/2
value transformers.
_______________________________________________
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