Re: Info window scenario
Re: Info window scenario
- Subject: Re: Info window scenario
- From: Julien Jalon <email@hidden>
- Date: Tue, 6 Nov 2001 16:05:29 +0100
Le mardi 6 novembre 2001, ` 11:30 PM, e.sammer a icrit :
[[[[notification object] windowController] document]
isMemberOfClass:[MyDocument class]]
and if so, doing [[InfoController sharedInfo]
setCurrentDocument:theDoc]. then, the apply button can work because i
have a reference to the current document.
It is the good idea and this is not a hack... but I would register
BecomeMainWindow instead of BecomeKeyWindow. In a document based
application, only documents windows become main (except if you create
special windows that can)
And, I would test windowController instead if you use a custom window
controller :
[[[notification object] windowController]
isMemberOfClass:[MyWindowController class]]
Using notification is the most elegant way... the documents don't have
to know about any inspectors. The inspectors are tools to modify the
document, they have to know about documents.
An other use of Notifications for inspectors: whenever the document
changes, it send a homemade notification to the notification center that
the inspector is observing. The inspector, then, ask for the documents
new properties.
With notifications, you can implement other inspectors, other panels
without changing a single character in the document/windowController
code.
--Julien