Re: Custom bindings in a control/cell pair
Re: Custom bindings in a control/cell pair
- Subject: Re: Custom bindings in a control/cell pair
- From: glenn andreas <email@hidden>
- Date: Thu, 24 Feb 2005 08:58:31 -0600
On Feb 24, 2005, at 7:29 AM, Ricky Sharp wrote:
I'm now adding custom bindings to my more complicated palette items.
These are all control/cell pairs.
I'm wondering if it's a good idea to put the implementation for
bindings completely in the cell class and just have the control class
'call through'. I don't see any problems in doing this. For example,
for unbind:, the control class would simply do this:
- (void)unbind:(NSString*)aBindingName
{
[[self cell] unbind:aBindingName];
}
the control's dealloc would call its unbind: for each binding. This
in turn will call through to the cell's implementation. The cell
class will also have dealloc which will call its unbind: But I'm
using appropriate accessors for the observed object and observed key
path attributes. Thus, even though a cell's unbind can be called
twice, it will only do work on the first call (will just message nil
on the second pass).
Didn't see any docs or examples on this after searching a bit. Has
anyone done custom bindings for a control/cell pair? I don't mind
being the first :)
That does follow the general pattern of "put a whole bunch of smarts in
the cell and have the control just be a simple wrapper" that is the
norm for cells/controls. By having the binding in the cell it will
also allow you to use the bindings when the cells are in NSTableViews
and NSMatrix.
(Now if there were just a documented way to make a "table view cell" IB
palette item so you could easily set the cell for a table column by
dragging and dropping it on the header cell, like you can for buttons,
pictures, sliders, etc...)
Glenn Andreas email@hidden
<http://www.gandreas.com/> oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
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