discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSPopUpButton behaviour


From: Enrico Sersale
Subject: Re: NSPopUpButton behaviour
Date: Mon, 10 Sep 2001 15:12:06 +0300 (EEST)

On Mon, 10 Sep 2001, Fred Kiefer wrote:

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

I've already changed all my popups or setting target and action for each
item, or using [popup titleOfSelectedItem] instead of [sender
titleOfSelectedItem] in the popupAction method.

Anyway a problem remains: the last item of all the menues is dimmed.
You can see this behaviour in Gorm too.
Open the Gorm Inspector panel and you will see that the last menu item,
"Help", in this case, is gray.

Enrico




reply via email to

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