Re: Custom window not getting delegate notifications
Re: Custom window not getting delegate notifications
- Subject: Re: Custom window not getting delegate notifications
- From: j o a r <email@hidden>
- Date: Thu, 28 Nov 2002 08:29:53 +0100
1) What if you, for testing purposes only, assigned some other object
to be the window delegate? Perhaps the delegate design pattern, as
implemented by Apple in the frameworks, doesn't allow for an object to
be it's own delegate.
If you, after assigning "self" to be the delegate, ask the window for
it's delegate - does it return "self"?
2) Would you get this notifications / delegate methods if you used a
standard NSWindow (and added these methods in a category - I don't know
if it's possible, just a suggestion).
3) You did mean the full designated initializer
"initWithContentRect:styleMask:backing:defer:", right?
4) Is your window borderless? In that case it will not automatically
accept to become key - you need to override that method from NSWindow
(more on this in the archives). If it never becomes key, you'll never
get the notifications... :)
5) If you signed up for notifications yourself you wouldn't need to get
notified for every window, since if you provide an object instance when
signing up for notifications then you'll only get notifications from
this object. This filtering is built into the notification system by
default.
j o a r
On Thursday, Nov 28, 2002, at 07:56 Europe/Stockholm, John Scalo wrote:
I have a custom window for which I call [self setDelegate:self] during
the
initWithContentRect method. However, the window's delegate methods
such as
windowDidBecomeKey, windowDidBecomeMain, etc never get called.
According to
the docs, "an NSWindow's delegate is automatically registered for all
notifications that it has methods for" so it seems they should work.
Now I know I could explicitly register for those notifications with
NSNotificationCenter, but that's not ideal because I'll get
notifications
for every window, not just this one.
FWIW, I did search the archives and found one identical question with
no
answers.
_______________________________________________
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.