Re: Another newbie question
Re: Another newbie question
- Subject: Re: Another newbie question
- From: Erik Buck <email@hidden>
- Date: Fri, 30 May 2008 06:05:15 -0700 (PDT)
A better subjuct might have been "How should I use interface objects to select command line arguments?" or something like that. The current subject adds no value and will not help others search for information in the future.
Having said that...
One approach you might take (that will not scale to large applications that use the MVC pattern) is to store strings as the represented objects of your user interface elements. Your code that composes the command line might look like this:
commandString = [NSString stringWithFormat:@"runfoo %@ %@\n", [[colorPopup selectedItem] representedObject], [[sizePopup selectedItem] representedObject]];
Use setRepresentedObject: ahead of time like this:
[[colorPopup itemAtIndex:0] setRepresentedObject:@"-color 4"];
[[colorPopup itemAtIndex:1] setRepresentedObject:@"-color 1"];
[[sizePopup itemAtIndex:0] setRepresentedObject:@"-small"];
--- or ---
You could give each user interface item a different action and build up your command line by setting the various options in response to action messages.
_______________________________________________
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