• 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: -[NSResponder flagsChanged:] not called?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -[NSResponder flagsChanged:] not called?


  • Subject: Re: -[NSResponder flagsChanged:] not called?
  • From: Marco Scheurer <email@hidden>
  • Date: Thu, 13 Jun 2002 01:12:43 +0200

On Wednesday, June 12, 2002, at 11:57 pm, Matt Neuburg wrote:
At 9:14 PM +0200 6/12/02, Marco Scheurer wrote:

I said "ahem" because you offered terribly bad advice. Subclassing
NSWindow is almost always a bad idea, and *certainly* was not the
solution in that case.
...
ask you to RTFM, or at least to doubt and ask yourself if your
experiment was correct before making such statements

I do indeed doubt my experiment was correct; that's why I asked you to show
me what was wrong with it. However, since you haven't done so, I must
continue to think my suggestion was a good one and an appropriate one. Here
are my reasons for thinking this:

First, let's read Garfinkel and Mahoney, p. 263: "Subclassing NSWindow is a
common technique for intercepting all of the events that are destined for a
window...". So - common technique, or almost always bad idea?

More on that later.

Next, let's try *your* suggestion. Do you remember what it was? Here it is:

Ahem. A NSWindow subclass is certainly not needed for that, a window
delegate will certainly catch these events if no one is doing this

This was one suggestion, the other being:

But in order to catch these events directly in your view, all you have to do is to make sure that, like for other keyboard events, it is first responder or in the responder chain.

Which was of course, the first thing to try, and the one that worked.

Well, I guess I think *you* should RTFM or at least doubt, etc., since
neither my reading of the docs nor my experiments confirm this claim.

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).

So it looks like your test was not wrong if what you tested was my first assertion, and I apologize.

In general: it is almost always a bad idea to subclass NSWindow because most of its behavior can be changed by its delegate, and most events can be handled by its delegate (action messages) or its next responder (event messages).

In this particular case: it is still a bad idea to subclass NSWindow to catch events that should have been caught in the NSView subclass.

Of course, there are times when subclassing NSWindow is the solution, but in that case, I still think that it was bad advice.


Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
_______________________________________________
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.

References: 
 >Re: -[NSResponder flagsChanged:] not called? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Doing the two-step?
  • Next by Date: Re: Forwarding key events to a non first responder?
  • Previous by thread: Re: -[NSResponder flagsChanged:] not called?
  • Next by thread: Re: -[NSResponder flagsChanged:] not called?
  • Index(es):
    • Date
    • Thread