• 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: Notification Sent When Window Is Ordered Back?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification Sent When Window Is Ordered Back?


  • Subject: Re: Notification Sent When Window Is Ordered Back?
  • From: "Chunk 1978" <email@hidden>
  • Date: Sun, 14 Dec 2008 11:02:39 -0500

i've set the window class to be it's own delegate:

- (id)init
	{
	if (self = [super init])
		{
		[self setDelegate:self];
		}
	return self;
	}

so shouldn't writing this method in the window's class work?

- (void)windowDidResignKey:(NSNotification *)notification
	{
	NSLog(@"window resigned key");
	}

??

On Sun, Dec 14, 2008 at 10:28 AM, Chunk 1978 <email@hidden> wrote:
> honest to god, i have zero idea why this isn't working... i've simply
> added this to my window's class and declared it in the header, but
> when the window resigns key by switching to another app, i see the
> window being ordered back, but NSLog does not output the message
>
> -=-=-=-
>
> - (void)windowDidResignKey:(NSNotification *)notification
>        {
>        NSLog(@"window resigned key");
>        }
>
> -=-=-=-
>
> On Sun, Dec 14, 2008 at 10:07 AM, Michael Babin <email@hidden> wrote:
>> On Dec 14, 2008, at 8:50 AM, Chunk 1978 wrote:
>>
>>> is this possible?  what method do i override when the window is
>>> ordered back, or has resigned as key window... i'm attempting to set
>>> some actions into play when a window is ordered back or no longer key:
>>>
>>> -=-=-=-
>>>
>>> - (void)orderBack
>>>        {
>>>        NSString *updateWindowNotification = @"updateWindowNotification";
>>>        [notificationCenter postNotificationName:updateWindowNotification
>>> object:self];
>>>        }
>>>
>>> -=-=-=-
>>
>> Look at the documentation for -[NSWindow resignKeyWindow] and/or -[NSWindow
>> resignMainWindow]:
>>
>> <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/resignKeyWindow>
>>
>> Note that you don't need to actually override the method for this one
>> behavior (delegate method windowDidResignKey and notification
>> NSWindowDidResignKeyNotification are both available).
>>
>>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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

References: 
 >Notification Sent When Window Is Ordered Back? (From: "Chunk 1978" <email@hidden>)
 >Re: Notification Sent When Window Is Ordered Back? (From: Michael Babin <email@hidden>)
 >Re: Notification Sent When Window Is Ordered Back? (From: "Chunk 1978" <email@hidden>)

  • Prev by Date: Re: Notification Sent When Window Is Ordered Back?
  • Next by Date: Re: NSDictionary valueForKeyPath:
  • Previous by thread: Re: Notification Sent When Window Is Ordered Back?
  • Next by thread: Re: Notification Sent When Window Is Ordered Back?
  • Index(es):
    • Date
    • Thread