Look at the other Currency Converter example (the non bindings one)

http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/01Introduction/chapter_1_section_1.html

this uses almost the exact same structure you're looking to implement.


On May 25, 2008, at 5:01 AM, Roland King wrote:

Imagine that I have a model with two properties, number and its square, something much like the currency converter. Ok I've written my model object, it generates events when things change so if you set the number, it computes the square and tells anyone listening about it.

View is easy - I have two text boxes.

Then I write a controller which has outlets for the two text boxes, and connections to the view so it knows when the text boxes update, and it is able to set properties on a model, and listen to the events on the model. ie lots of glue code.

So the idea is I type a number in the text box, the controller gets notified of the change, gets the number, sets the property on the model. The model computes the square and notifies anyone listening that it changed, the controller is listening, sees the change, gets the new square and sets the text box on the view.

That's my setup . So now I put the view and the controller in the NIB and I don't instantiate a model object in the NIB because I want to do that in code. This is a standard non-document application.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to