From: Ewan M. <mr...@mr...> - 2006-09-03 11:50:30
|
Great, thanks for the reassurance and advice, Ewan. On 1 Sep 2006, at 21:51, Scott Hyndman wrote: >> Hello, >> >> I'm trying to program my application using MVC pattern as described >> in Cocoa Fundamentals. >> >> "The delegate object itself is typically, but not necessarily, an >> object, often a custom object, >> that controls some part of the application (that is, a coordinating >> controller object)." >> CocoaFundamentals p148. >> >> Great so my thoughts so far I can either initialize my view objects >> with their controller e.g. >> var myView = (new MyView).initWithController((new >> MyController).init()); >> or as the text above suggests I can set it as a delegate and >> implement an informal protocol between the controller and view e.g. >> var myView = (new MyView()).init(); >> myView.setDelegate((new MyController).init)); >> >> From the actionstep source code there are three different ways to >> implement setDelegate in your Delegator >> >> It can be notified (see ASFieldEditor.as) >> It can be called directly and the delegate check to see that it >> conforms to informal protocol(see ASTreeView.as) >> It can be called directly but not checked to see if it responds to >> calls (see NSImage.as , when is m_delegate used?) >> >> You can create an interface if you want (ASFieldEditingProtocol.as) >> The naming strategy is either append Protocol or Delegate. >> >> Does this sound about right? > > Yes, it does. > >> So say I've got 10 small simple views shall I just bundle all my >> control code in one or two Controllers and set either as delegate for >> all the view? > > Yeah, you can absolutely do something like this. In fact, you may > notice that the first argument for most delegate methods is the > "sender", which is the object that is requesting the delegated > behaviour. Just do equality testing on that and have it behave > appropriately. > > Scott > > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > actionstep-core mailing list > act...@li... > https://lists.sourceforge.net/lists/listinfo/actionstep-core |