Skip navigation.
 
mlRe: New Document Behavior
FROM : James Spencer
DATE : Wed Oct 13 03:45:13 2004

On Oct 11, 2004, at 9:28 PM, Erik M. Buck wrote:

> There are many ways to execute code just after a document is opened or
> loaded.
>
> NSWinowController provides -windowDidLoad as a candidate to override
> in a subclass.
> NSWindow's elegate methods, – windowDidBecomeKey: and
> – windowDidBecomeMain:, can be handy.
>
> However, I suspect you want a variant of an answer provided just
> yesterday:
>
> http://www.cocoabuilder.com/archive/message/2004/10/11/119213
>
> Implement -windowControllerDidLoadNib: or -awakeFromNib to call [self
> performSelector:@selector(showUtilityPanel:) withObject:nil
> afterDelay:0.0f];
>
> On the next event loop pass after the document window is loaded, the
> showUtilityPanel: method will be called, and you can implement that to
> load and/or orderFront: you utility panel.


My apologies for not seeing the answer from the 11th; it was exactly on
point and your suggestion fully works.  Like the other person you
helped, I have no excuse for not finding it on my own, particularly as
your answer re the sheet was exactly analogous to my putting up the
window.

Just to note, I had tried -windowDidLoad, -windowDidBecomeKey, and
-windowDidBecomeMain but like -awakeFromNib, they are too early; the
main window has not yet actually been drawn on the screen and until it
is, it becomes the front window when all is said and done.  Your
suggestion of forcing a run through the event loop solved the problem. 
At that point, I can use -awakeFromNib, or any of the delegate
functions.

Anyway, thank you again.

James P. Spencer
Rochester, MN

<email_removed>

"Badges??  We don't need no stinkin badges!"

Related mailsAuthorDate
mlNew Document Behavior James Spencer Oct 12, 03:38
mlRe: New Document Behavior Jacob Lukas Oct 12, 04:15
mlRe: New Document Behavior Erik M. Buck Oct 12, 04:28
mlRe: New Document Behavior James Spencer Oct 13, 03:37
mlRe: New Document Behavior James Spencer Oct 13, 03:45