[Solved]: Trouble with design pattern

2011-02-19 Thread Carlos Eduardo Mello
Thanks Andy, Jon, Kirk, Murat and everyone who responded. All your advices were very usefull. I decided to use the delegate pattern and everything is working perfectly now. In fact I am starting to be able to implement sevall of my planed funcionalities just by adding messages to my working

Re: Trouble with design pattern

2011-02-18 Thread Jon Gary
Maybe I'm missing your point but the compiler warning is trivial to address. - [NSWindowController document] returns an id. If you want to call methods in your document class, CarlosDocument * doc = (CarlosDocument*) [windowController document]; [doc carlosMethod]; However if your views are cal

Re: Trouble with design pattern

2011-02-18 Thread mlist0...@gmail.com
Sorry, the forward declarations go in your .h files. You still have to import your MyDocument.h in your implementation files (ie. your CustomView.m files). What warnings are you getting? As far as your nil document problem, I don't know. I suspect something is not setup correctly. In your code

Re: Trouble with design pattern

2011-02-18 Thread aglee
I would use the delegate pattern. Look at some Cocoa classes that have delegates to get the idea of the general pattern. Examples: NSTableView, NSControl, NSURLConnection. My app, AppKiDo, provides an easy way to list classes that have delegates, and to skim the delegate methods. You could also

Re: Trouble with design pattern

2011-02-18 Thread Carlos Eduardo Mello
On Feb 18, 2011, at 5:46 PM, mlist0...@gmail.com wrote: On Feb 18, 2011, at 11:20 AM, Carlos Eduardo Mello wrote: I need to declare an instance of MyDocument inside my view's classes. The compiler won't let me do this unless I import MyDocument to the class definitions. you can use: @cla

Re: Trouble with design pattern

2011-02-18 Thread Carlos Eduardo Mello
If I just query the window controler for the document on demand like this: [ [ [ [ self window ] windowController ] document refreshParameters ]; the code works, but I still can't get rid of those "message-not- found" warnings: One correction: calls without arguments seem to be ok like this

Re: Trouble with design pattern

2011-02-18 Thread mlist0987
On Feb 18, 2011, at 11:20 AM, Carlos Eduardo Mello wrote: > I need to declare an instance of MyDocument inside my view's classes. The > compiler won't let me do this unless I import MyDocument to the class > definitions. you can use: @class MyDocument; in your .h file to forward declare MyDoc

Trouble with design pattern

2011-02-18 Thread Carlos Eduardo Mello
Hi Everyone, I am comming back to cocoa programming and to this list after a few years without programming anything, so please forgive me in advance for any stupid questions. I've read the docs, studied Hillegass's book again and searched the archives, but still couldn't find a definitive