pre-populating a pulldown menu?

I’m a complete novice to Xcode; only slightly better with applescript.

I’m trying to take one of my older applescripts that runs fine with myriad popup dialogs taking user input, and port it over to Xcode applescript objective-C so that I can run the script from a single panel.

I already have a text field in the MainMenu.xib bound back to a property value in the form

property theValue: ""

that returns the input value. But, I’d like to get the same results from a pulldown menu of pre-populated items like you’d get from AS with:

set FruitList to {"Banana", "Kiwi", "Mango", "Coconut", "Pear"}
set FavoriteFruitAnswer to choose from list FruitList with title "Fruit Dialog" with prompt "What's your favorite fruit?" default items "1. Banana"

But, in a pulldown menu using NSPopUpButton in Xcode

Is this something simple I’m missing, or is it a complex concept to master?

Add another property, and bind the popup’s Selected Index or Selected Value.

heh. like I said, I’m green. I guess my real question was how do you assign values to a button in the MainMenu.xib in the first place.

I never noticed the turndown arrow next to the item in the window sidebar :confused:
Once I stumbled upon that, it was all downhill.

Your suggestion of setting the pop up button to the value or index didn’t fall on deaf ears though. that helped a lot. thanks.

So, now I have the pulldown menu VALUES easily passed back to a variable in the AppDelegate. But, if I decide to pass the INDEX instead, what is the syntax in applescript.

For example, say I have my FruitList example above in AppDelegate. How would I map the index returned to those values?

0 would be Frankie Joe, 1 would mean Stevie Ray, and so on.