Adding bindings to a custom view - "simple" implementation
Adding bindings to a custom view - "simple" implementation
- Subject: Adding bindings to a custom view - "simple" implementation
- From: George Orthwein <email@hidden>
- Date: Mon, 17 Apr 2006 12:02:46 -0400
Hi All,
I've searched extensively and haven't quite seen this addressed....
I've added bindings support to my custom view following Hillegass's
lead (pg 385) by merely implementing setBindingName: and bindingName:
methods. He states there is seldom need to override
bind:toObject:withKeyPath:options:. It all seems to be working great
and my view is kept in sync with the controller/model.
e.g. in my view:
- (void)setHeaderHeightBinding:(id)height;
{
[self setHeaderHeight:height];
}
- (id)headerHeightBinding;
{
return headerHeight; //an aside: "return NULL;" here doesn't seem
to cause any problems...
}
So this seems quite a contrast to the much more complicated joystick
example (or mmalc's GraphicsBindings) which implements
bind:toObject:withKeyPath:options in the view along with several
other methods:
http://developer.apple.com/documentation/Cocoa/Conceptual/
CocoaBindings/Concepts/HowDoBindingsWork.html
Is it okay to use the "short" version? My view isn't a control so it
isn't initiating any updates. It looks like the "long" way would
allow more flexibility as well as NSEditorRegistration, but I don't
seem to need those for my view.
Thanks,
George
_______________________________________________
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