• 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: Question about poseAsClass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about poseAsClass


  • Subject: Re: Question about poseAsClass
  • From: Creed Erickson <email@hidden>
  • Date: Mon, 11 Aug 2003 18:14:05 -0700

I don't know the answers you're seeking, but it occurs to me that you've invented a difficult workaround to what looks like a non-problem.

In your window delegate, -windowWillClose:aNotification can simply iterate through all child windows and unconditionally send them -close. This should close any drawers. e.g.:

NSWindow *aChildWindow;
NSEnumerator *theKids = [[[aNotification object] childWindows] objectEnumerator];

while (aChildWindow = (NSWindow *)[theKids nextObject]) {
[aChildWindow close];
}

Caveat: coded in mail, no warranties or guarantees. Attempting to compile may cause your daughter to marry an aardvark.

If I have grossly over-simplified the problem, please let me know.

-- Creed


On Monday, August 11, 2003, at 02:12 PM, Tom Sutcliffe wrote:

I'm using poseAsClass to work around the fact that in Jaguar applicationShouldTerminateAfterLastWindowClosed doesn't work if a window had an open drawer when you closed it. (if you return YES the app isn't terminated because the app thinks the window the drawer is drawn into is still visible).

My question is when [MyWindowFix poseAsClass:[NSWindow class] should be called.

I tried putting it in my applicationWillFinishLaunching method. However it doesn't work properly and for some reason the app thinks all its windows are closed (and therefore terminates) when I close the drawer.

Then I moved it into my app delegate's +initialize method. Same problem.

Then I moved it even earlier in the call sequence, into +load. Now everything works perfectly.

I know poseAsClass says "The poseAsClass: message should be sent before any messages are sent to aClass and before any instances of aClass are created." which I'm assuming is the root of my problem. Can I rely on my app delegate's +load method being called before any NSWindows are created (or before whatever is done that causes the strange bug)?

If not, where should I put the pose call? I tried putting it in main.m which also works but I'd be interested in other people's views on > this.

Out of interest, does anyone have any idea why this bug is occurring? The app doesn't crash and the proper appShouldTerminate sequence is followed. And when my redefinition of [NSWindow close] merely calls [super close] and nothing else I still get this strange quitting problem.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Question about poseAsClass
      • From: Tom Sutcliffe <email@hidden>
References: 
 >Question about poseAsClass (From: Tom Sutcliffe <email@hidden>)

  • Prev by Date: Re: ResolvingAliases was: Re: NSFileManager's enumeratorAtPath can't handle aliases
  • Next by Date: SIGBUS/SIGSEGV error problems
  • Previous by thread: Question about poseAsClass
  • Next by thread: Re: Question about poseAsClass
  • Index(es):
    • Date
    • Thread