[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSMenu fix
From: |
Fred Kiefer |
Subject: |
Re: NSMenu fix |
Date: |
Fri, 24 Oct 2008 10:10:08 +0200 |
User-agent: |
Thunderbird 2.0.0.17 (X11/20080922) |
Applied, as there was no differing opinion.
Wolfgang Lux wrote:
> Fred Kiefer wrote:
>
>> 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 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?
>
> I think the best is to follow the specification from the NSMenu class,
> which reads:
>
> - (int)indexOfItemWithTarget:(id)anObject andAction:(SEL)actionSelector
> Parameters
> anObject
> An object that is set as the target of a menu item of the receiver.
> actionSelector
> A selector identifying an action method. If actionSelector is NULL,
> the first menu item in the receiver that has target anObject is
> returned
> Return Value
> The integer index of the menu item or, if no such menu item is in the
> menu, –1.
>
> In my understanding, this implies that the use of isEqual: in method
> indexOfItemWithTarget:andAction: was wrong in the first place and the
> inner conditional should simply read
> if ([menuItem target] == anObject) ...
> I have updated the patch accordingly.
>
> Wolfgang
>
>
>