• 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: [semi-newbie] Message sent to NSWindowController after complete window load
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [semi-newbie] Message sent to NSWindowController after complete window load


  • Subject: Re: [semi-newbie] Message sent to NSWindowController after complete window load
  • From: Simon Stapleton <email@hidden>
  • Date: Thu, 3 Oct 2002 14:39:34 +0200

mw

You might want to try adding something like the following to your window controller

- (void) windowDidLoad {
// other windowDidLoad code here
[self performSelector:@selector(showSheet:) withObject:nil afterDelay:0];
}

- (void) showSheet: (id) something {
// Code to show the sheet here
}

This will cause -showSheet: to be called as soon as the app drops into its runloop, by which point the window should be visible.

I hope this is of some help

Simon

Subject: Re: [semi-newbie] Message sent to NSWindowController after
complete window load
From: mw <email@hidden>
To: <email@hidden>

On 10/2/02 6:06 PM, "email@hidden"
<email@hidden> wrote:

on 02-10-02 4:37 PM, mw at email@hidden wrote:

It would seem that the sheet cannot be dropped because the window isn't in
"modal session" yet. In the debugger, the window isn't even visible when the
line of code that produces this error is executed.

WindowDidLoad (like awakeFromNib) is called before the window is visible, I
believe. I would expect trouble if you tried to present an alert sheet on a
window that isn't visible yet.

Hunting around for better places to present the sheet, I see NSWindow's
windowDidExpose delegate method. That might do the trick. Or if your window
opens on top of other application windows (I assume it does), you might try
windowDidBecomeKey or windowDidBecomeMain.

What method or function are you calling to present the sheet?

Yes, I did run into trouble with this one. :-)

I have a question about that delegate method though (before I try it
myself). Will it be called every time any portion of the window is exposed
(ie. If another window is moved on top of it and then moved off)? If so,
that won't work. I just need notification after the window has been loaded
and is visible. As for the other two methods, they will be called anytime
the window is activated after being deactivated; again that won't work.

For now, I am using the function -beginSheet of NSApp (the sheet is loaded
from a nib). I know there are other ways of calling an alert sheet natively,
but I have not gotten to that point in my book yet, and I would like to
practice (or at least figure out how to use) this method. Is there another
function that displays a sheet from a window loaded from an auxiliary nib
file that might work a little better?

Thanks,
mw

P.S. I re-posted this because last time I replied with a strange subject
line. Oops.
--
PGP Key Id : 0x50D0698D
--
Your mouse has moved. You must restart Windows NT for this change to be recognised.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: Re: How to organize an app (baffled with Accessor methods)
  • Next by Date: Menu items that reflect the document status
  • Previous by thread: Re: [semi-newbie] Message sent to NSWindowController after complete window load
  • Next by thread: interface with two mice: how ?
  • Index(es):
    • Date
    • Thread