Re: Interface Builder (How to list an object instance in "Bind to" popup menu?)
Re: Interface Builder (How to list an object instance in "Bind to" popup menu?)
- Subject: Re: Interface Builder (How to list an object instance in "Bind to" popup menu?)
- From: Gwynne <email@hidden>
- Date: Tue, 21 Dec 2004 16:39:40 -0500
On Dec 21, 2004, at 4:29 PM, Jeremy French wrote:
How do I get a model class to appear in the "Bind to" popup menu? This
is the popup menu labeled "Bind to", found In the bindings info panel
in Interface Builder.
I have a model class (named "Dot") that I added to Interface Builder,
by dragging its implementation file (i.e., ".h") into the Nib window.
The class appears in the "Classes" tab of the Nib window. I
instantiated an object instance of Dot, which appears in the Instances
tab of the Nib window.
I would like to bind the value property of a NSSlider instance to a
property in Dot.
I select the NSSlider instance and open the Bindings panel of the Info
window. However, "Dot" doesn't appear in the "Bind to" popup menu: I
only see two items: 1) "Shared User Defaults", and 2) "File's Owner
(NS Application)".
How do I get "Dot" listed in the popup menu?
Quite annoyingly at times, you can not bind directly to model objects.
You have to instantiate one of the subclasses of NSController
(NSObjectController for a single object, NSArrayController for a list
of objects, or NSUserDefaultsController for connections to
NSUserDefaults), hook its content outlet to the model object, and bind
to the controller. If you want to establish direct model bindings, you
have to do it progmatically. I suggest reading the Cocoa Bindings doc
at
<http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/index.html>.
-- Gwynne, key to the Code
Email: email@hidden
Web: http://musicimage.plasticchicken.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden