Hi… just another beginner speaking…

I'm coming from the rather procedural programming world of Applescript and web programming with PHP (OOP with CodeIgniter, though).

Coming from OOP PHP I found the concept of object oriented programming and the MVC pattern quite easy to adapt to Cocoa. Having Hillegass' 3rd Edition at hand is also a great thing, along with some great (video) tutorials on the internet.
But I'm yet having some odd difficulties.
It's not that much about strictly technical questions like "how do I get this to do that?", but rather questions like "okay, I can think of several ways to do this, it's just that I have no clue which path to take?"

Books like Hillegass or the documentations teach you how to do this or that specific task in a very good manner. But what I'm really missing are some lessons on how to glue the pieces you just learnt together to form a real app. (see my first example) Or just fairly trivial issues like "what's the best/most common practice for detecting an NBPopUpButton's selected item?", just to give an example.

Just to give an example:
How do I allow controller A to send commands to controller B and vice versa? If controller A initialized controller B, then A knew about B, but what about the other way round?

Just take this as an example:
Controller A is my AppController and does all the general GUI stuff like opening windows, swapping subviews, etc. Controller B is the class that performs the actual task. Controller B shall not have an instance in the nib. It gets its outlets by being passes to the nib as File's Owner via "setDelegate".

I then have a Button for invoking an action. NSButton sends an action to Controller A which then does some GUI stuff and then tells Controller B to perform its task. During the execution of this task Controller B might notice that something went horribly wrong and Controller A is highly needed to update the GUI.

But as only Controller A knows about B and not the other way round this seems not possible.

How would one solve such a thing?

Or to something completely different:
I have created a NSPopupButton in IB. I also created some MenuItems for it in IB.
How can I identify the current menu item?

One way would be to make every menu item an outlet of the controller and then just use something like:
if ([myPopupButton selectedItem] == myMenuItemOutlet) {
    //do something
}
But is this how to do such a thing? This would become quite messed up with every menu item you add to it.

I have to say that I'm feeling quite lost right now.

Thanks,
Vincent

Ps: Is there any generic(!) open source app that you would recommend me to study to learn more about how to structure an app at best? Optimal would be an app that's not too specific in functionality (extensive use of libraries e.g.) and gives a good idea about app structure in general._______________________________________________

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