• 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: Setting the Key window after sheet ends
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting the Key window after sheet ends


  • Subject: Re: Setting the Key window after sheet ends
  • From: Kevin Bracey <email@hidden>
  • Date: Sun, 18 Mar 2007 09:20:19 +1200

It's Amazing you haven't checked (id)sender

Cheers
Kevin

Amazing that there actually is not method to get the window to which
a given sheet is attached. Or, at least, I didn't find one.

One way to do this (typed in Mail):

-(IBAction)endProductSelector:(id)sender
{
	id parent;
	NSEnumerator *windowsEnumerator = [[NSApp windows] objectEnumerator];

	//find the parent window
	while(parent = [windowsEnumerator nextObject]){
		if([parent attachedSheet] == [self window]){
			[windowsEnumerator allObjects];
		}
	}

	// close the window
	[[self window] orderOut:sender];
	// end the sheet
	[NSApp endSheet:[self window] returnCode:1];

	if(parent != nil){ //this test may not be necessary
		[parent makeKeyAndOrderFront:self];
	}
}


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Setting the Key window after sheet ends
      • From: Allan Rentcome <email@hidden>
  • Prev by Date: Getting NSException on NSManagedObjectContext save:
  • Next by Date: Re: Preventing default drawing of slider bar in custom NSSlider class
  • Previous by thread: Re: Setting the Key window after sheet ends
  • Next by thread: Re: Setting the Key window after sheet ends
  • Index(es):
    • Date
    • Thread