Re: NSPopupButton & URLs
Re: NSPopupButton & URLs
- Subject: Re: NSPopupButton & URLs
- From: Matthew Lindfield Seager <email@hidden>
- Date: Mon, 28 Dec 2009 05:59:13 +1100
On Monday, December 28, 2009, Jeremy Matthews <email@hidden> wrote:
> Currently, I have a nspopupbutton with some general values "Airbus", "Southwest", "Delta", etc...upon making the proper selection and clicking the "generate" button, it creates the event with said attributes, including the URL. So, I have a list of about 10 items in that popup, and a loooong if statement. Depending on the selectedItem of the nspopupbutton, it grabs the associated url and stuffs it into the method and returns the event.
>
> Normally, I'd take a switch/case approach here, but I've been warned about doing so in Cocoa.
>
> Any ideas?
> It works fine now, but I know that there has to be a more graceful approach.
The first thought that comes to mind is a dictionary. The value from
NSPopupButton being the key that you use to obtain the corresponding
value from the dictionary...?
Matt
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden