Re: Populating an NSPopUpButton from an array
Re: Populating an NSPopUpButton from an array
- Subject: Re: Populating an NSPopUpButton from an array
- From: Ryan Zachary Hale <email@hidden>
- Date: Tue, 25 Mar 2003 19:32:34 -0600
++Sorry for the error message. Not sure why it happened...++
I'll try this. I want my menu to just list every string for SiteName,
so that I can then write to preferences what one the user selected, so
it can be used in other places.
(Also, If I append SitePath to SiteName, would I not get a string
looking like "SiteNameSitePath"?)
On Tuesday, March 25, 2003, at 06:20 PM, John Anderson wrote:
Ryan,
Obviously, it depends on what you what your menu to look like.
I am going to assume that your SiteName and SitePath object's are
NSStrings.
So, try something like:
SiteName = [SiteName stringByAppendingString:SitePath];
or
SitePath = [SitePath stringByAppendingString:@'"/"];
SitePath = [SitePath stringByAppendingString: SiteName];
- John Anderson
On Tuesday, Mar 25, 2003, at 19:02 America/Detroit, Ryan Zachary Hale
wrote:
Dumb question, but how would I go about merging my SiteName and
SitePath into strings and then a new array?
On Tuesday, March 25, 2003, at 05:50 PM, no98am59304_ wrote:
Just get merge your "SiteName" and "SitePath" in NSStrings and them
pack these strings into an array, like "menuItemNameArray." I call
removeAllItems: to keep things clean:
NSArray *menuItemNameArray;
NSPopUpButton *popUpButton;
[popUpButton removeAllItems];
[popUpButton addItemsWithTitles: menuItemNameArray];
If this is not working you problem lies elsewhere.
From: Ryan Zachary Hale <email@hidden>
Date: Tue Mar 25, 2003 18:03:25 America/Detroit
To: Cocoa Dev List <email@hidden>
Subject: Populating an NSPopUpButton from an array
Trying this again since I got no replies:
In my Cocoa app I would like to add items to a PopUpMenu for each
"record"
in an NSMutableArray. For example: it the user has added the title
a
record to my Array (that I store in UserDefaults), then each array
item (0, 1, 2, etc) would contain "SiteName" and "SitePath".
What I need now is a way to make as many menu items as their are
array items, and set each one to the corresponding "SiteName"
key/value.
I tried addItemsWithTitles:myArray but this isn't working. Any
other
ideas?
Ryan Zachary Hale
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.