Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSPopUpButton addItemsWithTitles...

NSPopUpButton addItemsWithTitles...
Thread Tools
macaroni
Fresh-Faced Recruit
Join Date: Dec 2002
Status: Offline
Reply With Quote
Aug 16, 2003, 06:27 PM
 
I want to add items to my NSPopUpButton with an array. This is the reason why I decided
to use addItemsWithTitles. I'm not sure exactly what exactly needs to be the items in the array.

addItemWithTitle: uses an argument of NSString *. Does the array need to be an array of NSString *. My array is actually an array of a class with the following instance varialbes

NSString *categoryDescription;
NSMutableArray *categoryRoles;

I want the NSPopButton to use the categoryDescription as the titles displayed.

I tried using addItemsWithTitles:categoryArray
and got Category isEqualToString: selector not recognized..
Can I not use the said method with an array of a class of mine..

What I want to accomplish is that when the user selects the NSPopUpButton, I then display is an NSTableView the categoryRoles.

Thanks.

ron
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 16, 2003, 09:51 PM
 
Yes, the array must be of NSStrings.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Uncle Skeleton
Addicted to MacNN
Join Date: Nov 2002
Location: Rockville, MD
Status: Offline
Reply With Quote
Aug 17, 2003, 10:16 AM
 
you probably could use an array of your own class, as long as your own class implemented enough of the NSString methods...
     
Rickster
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Aug 17, 2003, 07:38 PM
 
If you'd like the convenience of being able to pass an array of your model objects to an NSPopUpButton, take a look at our categories in the open source OmniAppKit framework. We have a couple of methods for doing just that -- your model objects just need a title method, and that's that. Quite useful in EOF apps, among other things...
Rick Roe
icons.cx | weblog
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:49 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,