On Monday, December 28, 2009, Jeremy Matthews <jeremymatth...@mac.com> 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com