Re: Binding different elements of an UI.
Re: Binding different elements of an UI.
- Subject: Re: Binding different elements of an UI.
- From: Matt Neuburg <email@hidden>
- Date: Sat, 02 Sep 2006 16:05:22 -0700
- Thread-topic: Binding different elements of an UI.
On Sat, 02 Sep 2006 10:52:36 -0600, "Keith Penrod" <email@hidden>
said:
>I'm wondering if there's a way to bind the different elements of a UI
>together. (For example, have a NSTextField that is visible only when a
>certain checkbox is checked or radio button selected.)
Sure, just bind both the checkbox's "value" and the text field's "enabled"
to the same thing. That's all there is to it. You don't even need code to
test this - in fact, you don't even need an Xcode project. Start up
Interface Builder and ask for a new Application project. Drag a checkbox
(switch) and an NSTextField into the design window, and drag an
NSObjectController into the main nib window. Now:
* Select the NSObjectController, command-1, check Automatically Prepares
Content
* Select the checkbox, command-4, bind its "value" to the
NSObjectController's selection.thing
* Select the NSTextField, command-4, bind its "enabled" to the
NSObjectController's selection.thing
Now command-R and try it out. Sure enough, the NSTextField enables and
disables as you check and uncheck the checkbox
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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