Skip navigation.
 
mlbinding to currentDocument
FROM : Gerriet M. Denkmann
DATE : Fri Aug 11 18:44:01 2006

In a document based app I have an Info Panel with an NSTextField 
which is bound to "'someString"

MyDocument.m: (MyDocument  is the delegate of its window)
- (void)windowDidBecomeMain:(NSNotification *)aNotification
{
   [ [ [ NSApp delegate ] valueForKey: @"inspectorController" ] 
setContent: self ];
}

- (void)close
{
   [ [ [ NSApp delegate ] valueForKey: @"inspectorController" ] 
setContent: nil ];
   [ super close ];
}


[ NSApp delegate ].h:
IBOutlet    NSObjectController    *inspectorController;
IBOutlet    NSPanel        *infoPanel ;


[ NSApp delegate ].m:
- (IBAction)showInfoPanel: (id)sender ;
{
   if ( infoPanel == nil ) load nib ...
   [ inspectorController setContent: [ [ NSDocumentController 
sharedDocumentController ] currentDocument ] ];
   [ infoPanel makeKeyAndOrderFront: self ];
}

This looks like quite a lot of glue code. Is there some easier way to 
accomplish this?

Gerriet.

Related mailsAuthorDate
No related mails found.