[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButton

From: Nicola Pero
Subject: Re: NSPopUpButton
Date: Mon, 8 Oct 2001 12:04:20 +0100 (BST)

> > > I would not consider NSPopUpButton that stable myself. As the
> > > specification is not telling which object should be sending the action
> > > method of a menu entry, this code might be wrong. Someone should do some
> > > testing on different platforms to determine the expected behaviour.
> > 
> > I did some tests on OpenStep, and I think the results are quite interesting:
> > 
> > If the action is set to NSPopUpButton [popUpButton
> > setAction:@selector(action:)], then NSPopUpButton is the sender of the 
> > action.
> > 
> > If the action is set to NSMenuItem(s) [menuItem 
> > setAction:@selector(action:)],
> > then NSMatrix (!) is the sender of the action.

This is quite strange as I would have thought as obvious that the sender
would have always been the NSPopUpButton ... and Georg agrees with me
otherwise he wouldn't have been surprised by finding that the sender was a
matrix in this case ... I would consider that an implementation bug in the
apple code ... surprising APIs are bad APIs ... it's not really meaningful
that the sender changes depending on which action is used ... the general
rule is that the sender is the control, in this case the NSPopUpButton ...  
there is even less sense in exposing the NSMatrix as the sender, because
the NSMatrix in this case is an internal private object used by the code
to implement the behaviour ... the public interface goes through
NSPopUpButton, so that is the sender which should be exposed to

we might consider implementing the sender to always be the NSPopUpButton
in gnustep, IMHO it makes more sense, and it's more consistent to always
have the same object sending the action ... it shouldnt' make any
difference to most application code, should it ?

I might be wrong as I didn't have time to read any of the code or look at
the doc, so feel free to ignore my suggestions if I'm missing something

reply via email to

[Prev in Thread] Current Thread [Next in Thread]