Re: Filtering breaks bindings-enabled app
Re: Filtering breaks bindings-enabled app
- Subject: Re: Filtering breaks bindings-enabled app
- From: Dan Stein <email@hidden>
- Date: Tue, 25 Jan 2005 07:59:03 -0800
On Jan 24, 2005, at 9:34 PM, mmalcolm crawford wrote:
On Jan 24, 2005, at 8:13 PM, Dan Stein wrote:
FIRST QUESTIONABLE DESIGN DECISION: To support the undo manager and
pasteboard, the document class also declares a separate array that
gets bound to the array controller's content array by setting that in
the controller's bindings pane in IB. I have read the documentation
to indicate that this array should change in lock step with insert:
and remove: messages to the array contrroller.
I'm not sure I follow: Do you mean that you have two arrays containing
your model objects (i.e. your document class has an array that shadows
that in the second model object)? If I haven't misunderstood, then
you should not be doing this and it may well lead to errors. Please
let know which documentation suggests this pattern.
mmalc
Yes that is exactly what I am doing, and I pretty much agree with you
that it was not a good idea.
I think my assumption that this second array should shadow the array
controller's content array is a "creative" reading
of the documentation. The fact that I was able to bind the controller's
content to it, and that it worked up to a point
is not the same as saying "the documentation made me do it". I should
have said "the frameworks allowed me to do it."
In fact, the example in the Hillegass book doubtless does not do this,
though I cannot recall for sure.
What Hillegass does is use an array of model objects in his document
class to register for undo manager operations.
Of that I am sure, but I can't recall the details of how he keeps it up
to date with the content array in the array controller.
(I borrowed the book to pursue the development, and don't have it for
reference any longer).
The array in my second model class is synched with the array
controller's version only when an archiving operation
is ordered. In that sense it is only for archiving and not for
maintaining the view in a consistent state.
Yes, I know the bindings (without my "creative" additions) are supposed
to keep the view updated, and I thought
I had set that up correctly. But how then to register additions and
deletions with the undo manager? I just checked
my example project taken from the Hillegass example, and indeed, the
array controller's content array is bound
to the "people" array in the document class. I guess that is how I got
the idea, and not from the "documentation"
(whose name should not have been taken in vain. my bad! my bad!)
_______________________________________________
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