Re: -[NSResponder flagsChanged:] not called?
Re: -[NSResponder flagsChanged:] not called?
- Subject: Re: -[NSResponder flagsChanged:] not called?
- From: Matt Neuburg <email@hidden>
- Date: Fri, 14 Jun 2002 10:48:05 -0700
On Thu, 13 Jun 2002 01:12:43 +0200, Marco Scheurer <email@hidden> said:
>
I've got to admit I was wrong: I was thinking window controller
>
(NSWindowController) and wrote delegate. For the window's delegate to
>
catch event messages, it should be a subclass of NSResponder and be set
>
as the window's nextResponder (and it being the delegate is then of
>
course irrelevant).
Right. There are several confusions into which one can fall here. First,
there is the Lesser Responder Chain vs. the Greater Responder Chain; the
Greater (for nil-targeted action messages) has the delegate hard-wired into
it, but the Lesser (for user events) does not. Second, in a typical
doc-based app, a window's NSWindowController is the File's Owner and is
therefore also set up by default as the window's delegate; but in that case
it receives flagsChanged: qua NSWindowController, not qua delegate.
>
So it looks like your test was not wrong if what you tested was my first
>
assertion, and I apologize.
Fine.
>
Of course, there are times when subclassing NSWindow is the solution,
>
but in that case, I still think that it was bad advice.
I didn't mean to advise anything, really. The OP seemed to think that
flagsChanged: was just plain broken; I wanted to tell him that it wasn't,
since my app catches it just fine, and to tell him how this was
implemented. In the case of my app, where I want to receive flagsChanged:
just exactly in case a certain window is frontmost, I think subclassing
NSWindow is perfectly appropriate and the simplest solution. Not every app
is doc-based and not every window has or needs an NSWindowController
subclass, after all. I didn't mean to imply this was the only way or the
best way in all circumstances; I simply wanted to provide a way that I knew
worked, so that the OP could prove to himself quickly that the feature was
operating. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.