Re: Populating an NSPopUpButton from an array
Re: Populating an NSPopUpButton from an array
- Subject: Re: Populating an NSPopUpButton from an array
- From: no98am59304_ <email@hidden>
- Date: Tue, 25 Mar 2003 18:50:06 -0500
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.