Re: Object change to NSView update
Re: Object change to NSView update
- Subject: Re: Object change to NSView update
- From: "Jonathan del Strother" <email@hidden>
- Date: Fri, 22 Aug 2008 16:09:55 +0100
On Fri, Aug 22, 2008 at 3:58 PM, Paul Bruneau
<email@hidden> wrote:
> I feel I can nearly grasp what I need to do, but not quite. I know what I
> shouldn't be doing--which is what I am doing and I feel I'm a little in the
> weeds. I seek a nudge in the right direction if someone can help.
>
> I have a master-detail setup with a normal table displaying a list of
> orders. Below it is my subclass of NSView which draws a tree diagram of the
> selected order and its descendent order steps, each of which might have its
> own descendants. In fact, here it is:
> http://special-lite.com/satellite/Picture 4.png
>
> I am forcing the view to update after a change to one of the order step
> objects in what I am sure is The Wrong Way™ by basically chucking
> setNeedsDisplay into areas of my code such as the contextual menu handling
> code, etc. This works great for GUI-driven changes even though it's wrong,
> but it falls apart of course when changes occur due to Applescript.
>
> What I think I understand that I need is that when an object belonging to
> the current selection of the table is modified, that a controller is
> notified and it tells the view to update. Or perhaps I can programmatically
> bind the view to the table's selection.
>
> 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.
>
> If someone could give me a short breakdown of the idea of how to do it, I
> will happily go read hours of documentation and examples to learn the
> details.
>
How about having the object post an NSNotification whenever it's
changed? Your controller can observe the notification & call
setNeedsDisplay accordingly.
If you're posting a lot of notifications at the same time, you might
look at coalescing them
(http://developer.apple.com/documentation/Cocoa/Conceptual/Notifications/Articles/NotificationQueues.html)
_______________________________________________
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