On 21 Aug 2011, at 18:59, Luc Van Bogaert wrote:

On 21 Aug 2011, at 15:43, Jerry Krinock wrote:


On 2011 Aug 21, at 05:02, Luc Van Bogaert wrote:

Adding a windowcontroller to the mainmenu nib also doesn't work, as the windowcontrollers should be instantiated from my document objects. right?

That is correct.

So, that leaves me the option to use the First Responder object. This does work, but I'm still wondering if maybe there is a better approach.

There is no better approach. "First Responder Magic" is a good thing to use.


OK, thanks.

But this still leaves me with the question of how to reference my windowcontroller objects from the mainmenu nib? I need this because I want to modify the title of some menu items, depending on the state of the document windows. So I would like to make my windowcontroller objects menu delegates.

I thought about using an application delegate as file's owner in the mainmenu nib, and then target the menu items from this delegate. From the app delegate I can reference the window using keyWindow, but I haven't found a way to reference the windowcontroller objects...

When creating the window controller in the document's method makeWindowControllers, you might set a property (you declared) to this window controller. This way you will have access to it from all methods of the document, including action methods. You should also be able to bind the button's title to something like "document.myWindowController.myButtonTitle".

Regards
Klaus

_______________________________________________

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 arch...@mail-archive.com

Reply via email to