Re: how to add multiple-selection pull-down menu in IB?
Re: how to add multiple-selection pull-down menu in IB?
- Subject: Re: how to add multiple-selection pull-down menu in IB?
- From: Paul Chinn <email@hidden>
- Date: Sun, 6 Nov 2005 17:23:27 -0800
Actually, before even dealing with how to implement the backing code,
I don't even see how to create the GUI element itself. The
NSPopUpButton widget and class (which Mail.app appears to use) looks
like it only allows a single selected item, and will display the
current selection as the contents of the button.
So I'm trying to figure out how to create one that displays a non-
changing title in the button, then drops down a menu with various
selected choices.
--paul
On Nov 6, 2005, at 1:49 PM, Justin Anderson wrote:
I don't think it's possible to do this purely in IB. It is possible
to do it without much code though.
1. Save an array of the selected item titles to defaults.
Initialize the menu items' on/off states with those values at startup.
2. Have every menu item call an action which toggles its state and
adds/removes it from the array of titles in defaults.
3. Use key value observing to pick up changes to the array in
defaults.
It seems Mail.app does something similar to this — my user's
com.apple.mail.plist contains boolean flags for each individual
column, as opposed to my idea of an array of strings.
Justin Anderson
http://www.tensaimac.com/
On Nov 6, 2005, at 2:59 PM, Paul Chinn wrote:
Hi,
In one of my windows I'd like to have a menu that the user can
drop down to select any number of multiple options. Basically
like the visible-columns menu that drops down when you right click
in the message list in Mail.app or the library in iTunes, except
there'd be a visible button for the user to click.
Infact, as I type this email, I see Mail.app's visible-headers
button is pretty much exactly what I want(though I could use a
text title instead of icon). However, when I examine the nib in
IB I'm can't get a sense of how it's wired up.
Can anyone point me in the right direction?
--paul
_______________________________________________
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