This is a bit hard to explain but I'll try to keep it simple and clear.... The short version would be: "Can two nib files share an instance of a custom class instead of both creating their separate instance"...

The long version:

I have a custom window controller (let's call it CustomWindowController) to manage a custom window... this is contained in a separate nib file (i.e. not in my MainMenu.nib)

In that window's nib file, the File Owner is set to that CustomWindowController class so that my class can communicate with my window...

Now let's say I have an action in my CustomWindowController (for clarity's sake let's call it performActionClicked: )

I connected my window's button to it's FileOwner's performActionClicked action... good, everything is working well...

Now here comes the tricky part: I want a menu item from the app's main menu (located in MainMenu.nib) to ALSO be able to perform this action (the same performActionClicked: thats located in my CustomWindowController)....

My first idea was to add an "Object" to my MainMenu.nib and set its class to CustomWindowController, that way I can access its actions... but the problem is that both nib files create their own instance of CustomWindowController.... (I know this because I put an NSLog(@"Im awake!"); in my CustomWindowController's awakeFromNib... and, as I expected, the message appears twice in the console...

Is there a way that both nib files can "share" the same instance of my CustomWindowController???


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.com

_______________________________________________

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