Re: Responder Chain Multiple Windows

2008-11-10 Thread Todd Heberlein


On Nov 10, 2008, at 5:31 AM, Graham Cox wrote:



On 11 Nov 2008, at 12:11 am, Todd Heberlein wrote:

From the documentation it seems that the window's  
NSDocumentController, even though it isn't the document's main  
window, should still be in the responder chain.


I assume you actually mean the window's NSDocument (or subclass  
thereof) - there is only one shared NSDocumentController in an app.


How are you creating the secondary windows? If you instantiate the  
controllers yourself you need to add them as subcontrollers of the  
document using its -addWindowController: method.


Oops. Yes, MyDocument is a subclass of NSDocument and  
BrowserViewController is a subclass of NSWindowController



In MyDocument I have a method that has the following code:

  BrowserViewController* bvc;

  bvc = [[[BrowserViewController alloc] init] autorelease]; //  
init loads NIB

  [self addWindowController:bvc];
  [bvc showWindow:self];


Both MyDocument and BrowserViewController implement the method (which  
is the action for the menu item):


- (IBAction) extractAuditSession: (id) sender;

But the menu item is only available when the window associated with  
MyDocument is key. When the window associated with  
BrowserViewController is key, the menu item is dimmed out.


Todd

___

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]


Re: Responder Chain Multiple Windows

2008-11-10 Thread j o a r


On Nov 10, 2008, at 9:00 AM, Todd Heberlein wrote:

Oops. Yes, MyDocument is a subclass of NSDocument and  
BrowserViewController is a subclass of NSWindowController



...should probably be called BrowserWindowController in that  
case...:-)




In MyDocument I have a method that has the following code:

BrowserViewController* bvc;

bvc = [[[BrowserViewController alloc] init] autorelease]; //  
init loads NIB

[self addWindowController:bvc];
[bvc showWindow:self];


Both MyDocument and BrowserViewController implement the method  
(which is the action for the menu item):


- (IBAction) extractAuditSession: (id) sender;

But the menu item is only available when the window associated with  
MyDocument is key. When the window associated with  
BrowserViewController is key, the menu item is dimmed out.



What if you make the window controller the delegate of the window?


j o a r


___

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]


Re: Responder Chain Multiple Windows

2008-11-10 Thread Todd Heberlein

What if you make the window controller the delegate of the window?


Ka-ching!  Thanks. that did it.

Todd

___

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]