Custom menu drawing / NSPopupButtonCell question
Custom menu drawing / NSPopupButtonCell question
- Subject: Custom menu drawing / NSPopupButtonCell question
- From: Ken Tabb <email@hidden>
- Date: Wed, 1 Dec 2004 12:11:01 +0000
Hi folks,
Don't think I'm thinking straight today, so apologies if this is a
no-brainer to most of you!
I have a tool palette containing a matrix of buttons (NSButtonCell)
which I'd like to display popup menus when the user clicks on them
(with a different menu for each button, and where some buttons have no
menu at all). I tried populating the matrix with NSPopupButtonCell, but
it doesn't seem to allow me to show the button as "clicked in" once the
user selects something in the menu (no amount of
setButtonType:NSPushOnPushOffButton seems to make it happen).
Furthermore I don't want a standard menu to appear, I'd like a matrix
of icons to appear (taking the images from each menu item, highlighting
the one that was selected last time etc.). Kind of like iChat's icon
menu - where you select previously used icons by clicking on your icon
in the "Buddy List" window.
I notice there are NSMenuView / NSMenuItemCell classes, which would
seem to be a great way of customising what I'd like to do. However
they're marked as deprecated in 10.x, even though some current docs
still point to them (eg. "How Menus Work"). Is there a similar
mechanism I could subclass to get a button to easily display my custom
menu instead of a standard texty, one item per row menu? Or do I have
to completely roll my own (including figuring out where on screen the
custom menu would 'fit' so that it doesn't get drawn half off the
screen), adapting an NSButtonCell so that it becomes (effectively) an
NSPopupButtonCell with custom menu and ability to click itself in?
Thanks in advance for any feeders you can throw my way,
Ken
- - - - - - - - - -
Dr. Ken Tabb
Mac & UNIX Developer - Health & Human Sciences
Machine Vision & Neural Network researcher - School of Computer Science
University of Hertfordshire, UK
http://www.health.herts.ac.uk/ken/
Certified non-Microsoft Solution Provider
_______________________________________________
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