[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSMenu fix
From: |
Fred Kiefer |
Subject: |
Re: NSMenu fix |
Date: |
Thu, 23 Oct 2008 10:07:19 +0200 |
User-agent: |
Thunderbird 2.0.0.17 (X11/20080922) |
Wolfgang Lux wrote:
> The following patch fixes NSMenu's -indexOfItemWithTarget:andAction:
> method so that it becomes possible to look up items with a nil target,
> i.e., which send their action to the first responder.
I am not that sure about this change. My current idea is to check
whether the handed in object is nil and to return any item matching the
selector for that. This would be consistent with the way we currently
handle the selector.
But even that idea may be wrong for some cases.
Lets list the different case we should be able to handle.
First we could either get a selector handed in or not. Without a
selector we can just check whether the target matches. When no target is
handed in we have the to possibilities to match all items or just the
ones that also have nil as the target. With a target we of course need
to check whether it is equal.
When a selector gets handed in, we again could either get a target or
not. Without a target we have the same two choices for the
implementation as above. But even with a handed in target we have a
choice. When the target of the item is nil we could either turn this
item down or check whether the actual target (determined by calling
[NSApp targetForAction: [menuItem action] to: [menuItem target] from:
self]) is equal to the provided target.
I would like to hear some more opinions on those choices before deciding
what to do. Perhaps somebody could check on Apple what they are doing?
Fred
- NSMenu fix, Wolfgang Lux, 2008/10/22
- Re: NSMenu fix,
Fred Kiefer <=