Pull-down menu weirdness
Pull-down menu weirdness
- Subject: Pull-down menu weirdness
- From: Keith Blount <email@hidden>
- Date: Sat, 15 Jul 2006 02:24:19 -0700 (PDT)
Hello,
I am currently implementing an action pull-down menu
like the one at the bottom of the mailboxes in
Mail.app. I expected this to be very trivial, but it
is not. I had to subclass NSPopUpButtonCell and
NSPopUpButton to call through to an NSButtonCell to do
all the drawing, and now that is all looking good.
However, the problem I now have has nothing to do with
the subclass, as it occurs in normal NSPopUpButtons.
My pop up button is set to be a pull down menu. By
default, pull-down menus use the first item in the
menu for the title. How do I prevent this behaviour? I
set -setUsesItemFromMenu: to NO, but this didn't make
much of a difference. Of course, I could just have a
dummy item at the top of my menu, but looking at the
.nib files from Mail.app, I see that the
MailboxesContextMenu.nib has no need to do this, so
there must be a way to prevent this behaviour.
Strangely, the pull-down seems to behave differently
if I use the default menu that is attached to the
NSPopUpButton in IB or if I connect it to a different
menu using its -menu outlet.
If I use the default menu in IB, the first item isn't
necessarily used for the popup's title and therefore
doesn't disappear from the menu. However, attaching
menu items to an action doesn't work - they don't do
anything and just become checked (which I don't want -
this should be an action menu).
If I connect the popup to a different menu, the first
item in the menu disappears (because the popup is
trying to use it for its title, even though I am only
using an image), but I CAN attach actions to the menu
items and have them work.
Is there any reason for this discrepancy? And does
anybody know how I can always prevent the first item
in a menu from disappearing when attached to a
pulldown menu that doesn't want to use the first item
for a title?
Thanks in advance,
Keith
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden