Re: Synchronized outlets and actions
Re: Synchronized outlets and actions
- Subject: Re: Synchronized outlets and actions
- From: Hamish Allan <email@hidden>
- Date: Thu, 5 Jan 2006 18:26:31 +0000
On Thu, 5 Jan 2006 17:12:37 +0000 (GMT), Dan Price wrote:
I don't think it will be as simple as that. For one thing, many of
these properties are stored in C++ classes (my app's core is C++,
with ObjC wrappers and glue code).
All you need is for any control needing to reflect the data in a
model to have a reference your wrapper class. Then you simply provide
KVC-compliant methods:
-(id)foo;
-(void)setFoo:(id);
in that wrapper class.
For another, these controls are in palettes in seperates nibs from
the NSApplication delegate. They're currently handled by the
palettes' NSWindowController delegate - it accesses the app
delegate from the NSApplication object, and then accesses that to
get the document object containing the model. It's all done in
code, and isn't as elegant as I would like. How on earth could I do
that with bindings?
If each nib's File's Owner is an NSWindowController, and your
document object provides KVC-compliant access to the model, your key
path (relative to File's Owner) should be something like "
document.model.foo" (c.f., "[[[filesOwnerOutlet document] model] foo]").
Can someone point me to a good doc on bindings? One which goes
beyond the single-window application example. Any implementation
must be compatible with 10.3 and I'm not using Core Data either.
I don't know about docs, but good example code is available at http://
homepage.mac.com/mmalc/CocoaExamples/controllers.html
Bindings are just a replacement for the controller layer you used to
have to write yourself. Understanding them is orthogonal to
understanding how to handle multiple nibs and windows -- if you can
handle the latter without using bindings, you just need to understand
how to use key paths to traverse object relationships.
http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueCoding/index.html
http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueCoding/Concepts/BasicPrinciples.html
http://www.cocoadev.com/index.pl?KeyValueCoding
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Concepts/HowDoBindingsWork.html
Best wishes,
Hamish
_______________________________________________
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