Re: Stupid problem with NSPopUpButton
Re: Stupid problem with NSPopUpButton
- Subject: Re: Stupid problem with NSPopUpButton
- From: Matt Neuburg <email@hidden>
- Date: Wed, 4 Sep 2002 12:07:04 -0700
On Wed, 4 Sep 2002 05:05:05 -0700, Matt Covey <email@hidden> said:
>
As others have noted, having two items that are exactly the same in a
>
popup is confusing (how does the user tell them apart?)
>
>
However, there are a few times when you want to have the same text label
>
because you're able to distinguish between them by other means
In my opinion it's none of Cocoa's darned business why I want to have the
same text label. This behavior of silently failing when I tell it to add an
item with a certain title is unnecessary and unwanted interference, and in
my view it counts as a bug.
>
[popup_button addItemWithTitle: @"x"];
>
[[popup_button lastItem] setTitle: @"Duplicate text"];
>
[[popup_button lastItem] setImage: image_1];
If you're building the whole menu from scratch, it is more efficient to
construct the NSMenu with a series of NSMenuItems (which avoids this silly
and perhaps time-consuming title checking) and then just make that the
popup's menu. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.