• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: MVC question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MVC question


  • Subject: Re: MVC question
  • From: Koen van der Drift <email@hidden>
  • Date: Mon, 9 Feb 2004 21:04:47 -0500

On Feb 8, 2004, at 4:18 PM, Ryan Bates wrote:


Let's say you are drawing a clock. You could create a Clock model class that keeps track of time. You could then create a ClockGraphic class that draws a Clock object. You could even go a step further and create an AnalogClockGraphic and a DigitalClockGraphic to draw the same Clock two different ways.

In my case what's drawn is a directed acyclic graph. Now lets say the user adds a new node by editing the view, eg by dropping a node from a palette between two other nodes. The information about the new node and location is then passed to the controller and model, which then creates the new node in the correct position (in the graph I mean, not the view). Then the controller gets notified that the model has changed, and tells the view to draw the new node where it was dropped and to which other node it needs to be connected. Now how does the information of the new node get to the view? Is it ok to pass a pointer from the model to the view? And where do I store the coordinates of each node? Especially this last point is what puzzles me.

Are there any Cocoa examples of apps that draw a (directed acyclic) graph?


An additional question, since I am rewriting the app from scratch, would this type of app benefit from using Cocoa bindings?

I really don't know much about bindings, but it seems to be best suited for widget-type applications. Throw bindings in with a couple buttons and a table view and you can create a simple program with almost no code, but when it comes to a drawing application where most of the GUI is made up of custom objects, it might be harder to implement bindings. I could be wrong though.

I have some textfields that need to be updated when the graph changes, so I guess bindings can be useful there.



thanks,

- Koen.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: MVC question
      • From: Ryan Bates <email@hidden>
References: 
 >MVC question (From: Koen van der Drift <email@hidden>)
 >Re: MVC question (From: Ryan Bates <email@hidden>)

  • Prev by Date: Re: Drawing onto NSImageView subclass (Newbie)
  • Next by Date: Type/Creator codes for RTFD Documents
  • Previous by thread: Re: When/how to use bindings (was Re: MVC question)
  • Next by thread: Re: MVC question
  • Index(es):
    • Date
    • Thread