discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSPopUpButton behaviour


From: Fred Kiefer
Subject: Re: NSPopUpButton behaviour
Date: Mon, 10 Sep 2001 11:59:40 +0200

Hi Enrico,

yes there is indeed a problem with the current code, but it is slightly
different from what you may think.
I did change the implementation of NSPopupButtonCell so that when adding
a new menu entry the action and target of this entry are set to those of
the popup. This is according to the specification that entries can
either use their own action and target or use that of the popup. This
requires that the action and target of the popup are set before any
entries are added!
Now what is causing you the trouble is that the action is send twice,
once by the NSMenuItemCell that you select and again by the popup button
itself, as the old code here still things that there is no explicit
action for the entries. In your method [popupAction:]  you expect to get
a NSPopupButton, but do get a NSMenuItemCell which gives you the
doesNotRecongnizeSelector exception. 
The problem with the old implementation was that it was not possible to
change the action/target for a single entry to something else. So if we
think that the entries should have specific actions we should remove the
standard action call in [NSPopupButton mouseDown:] (and maybe loop over
all entries without action/target when that is set for the popup
itself). And you should not expect the sender in popupAction: to be a
NSPopupButton.

I hope this help to clear the issue and if somebody thinks she knows
which way to go, feel free to give your advice.

Fred





reply via email to

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