How do I use selectedItem() for a popup button with a specific tag? Or do I use a different method?
Thanks,
Brad Bumgarner
How do I use selectedItem() for a popup button with a specific tag? Or do I use a different method?
Thanks,
Brad Bumgarner
Could you be a little more specific about what you want?
Ric
It’s not clear to me what you want. Calling selectedItem() returns what it implies; you can get its tag using tag().
I’m trying to get the selected menu item of a popup button with a given tag. The tags of the popup buttons have been set up in IB. The given tag is derived from other actions within the app.
I hope that helps, Thanks
Brad Bumgarner
You could put the property names for your different popups (assuming you have them) into an array, such that their positions in the array, are the same as their tags, so that if the number you need to respond to was 2, for instance, you could get the selected item by using theArray’s objectAtIndex_(2)'s selectedItem().
You could also do it with less code if you had your popups inside an NSBox, and have their positions in the view hierarchy the same as their tags. That way you could get to a popup with the tag 2 with this:
log theBox’s contentView()'s subviews()'s objectAtIndex_(2)'s selectedItem()
Ric
Or even a matrix in Tracking mode…
Thanks Ric and Shane for your help. I decided to go the most direct route and created an array of objects. I had already set up my tags as zero-based so that made it easy to go the array route.
Thanks,
Brad Bumgarner