• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: New Document Behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New Document Behavior


  • Subject: Re: New Document Behavior
  • From: James Spencer <email@hidden>
  • Date: Tue, 12 Oct 2004 20:45:13 -0500


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@hidden

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

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Re: New Document Behavior (From: "Erik M. Buck" <email@hidden>)

  • Prev by Date: Re: CGShading
  • Next by Date: Re: CGShading
  • Previous by thread: Re: New Document Behavior
  • Next by thread: [NEWBIE] How to localize toolbar button?
  • Index(es):
    • Date
    • Thread