Re: Object change to NSView update
Re: Object change to NSView update
- Subject: Re: Object change to NSView update
- From: Paul Bruneau <email@hidden>
- Date: Fri, 22 Aug 2008 13:21:18 -0400
On Aug 22, 2008, at 11:19 AM, Graham Cox wrote:
On 23 Aug 2008, at 12:58 am, Paul Bruneau wrote:
I think I could maybe (maybe!) figure out how do this for the order
(the table's selection), but I am totally lost as to how I would do
it for the order's great-grandchildren order steps.
Data structure?
Does an order keep a list of its children? And those objects keep a
list of their children and so on? Then just propagate "needs
display" change to the children, then they'll do the same, and so
on. Usually these will all be objects of the same class, or share
some common subclass, or at least have certain methods in common.
You have to arrange all of this.
<snip code>
Now assuming that these objects are all linked together correctly in
a nice tree structure, sending -flagChanged to the root object will
propagate that change down to every child and every child's child,
and so on.
This is very conceptual, but may help - does it?
Note that this assumes that if you are modelling something that is
structured as a tree or hierarchy in real life, you've implemented
it as a tree or hierarchy in your code. Normally this is what you
would do!
Thank you Graham. Yes, sorry I failed to say, but yes, the root
"order" object has an NSArray of its "nextSteps" and each order step
object also has an array of its "nextSteps".
But I am not so much worried about propagating down to the children,
for it is the children who are getting changed without the root
object's knowledge.
However, I do also have a "previousStep" pointer in each order step
that points back up to its parent that I could utilize.
But similar to the other suggestion, I would have to be doing this
every time anything changed about any order step, then I would have to
communicate from the parent (order) object to this view directly?
Which makes bells go off in my head that the model isn't supposed to
be sending stuff to the view?
But I do like your suggestion because it is a way that I might come up
with, but I'm nervous that it isn't the Right Way.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden