popup buttons inside a box

Hi everyone,
I am working on a little applescript studio app and I have decided to incorporate popup buttons to select different options. I have two sections of the window, each one is a “NSBox” the sort of indented “section” object (in the same object panel as the tab view). Anyway, all the standard buttons in box 1 work, but i cannot get the selected popup item info from the popupbutton in box 2. The odd thing is that it works when it is not in the box! As soon as you set up the interface so that the popup button as well as the button that starts the action handler (which trys to get the item info from the popupbutton) are inside the box, the code returns a “NSReceiverEvaluationScriptError: 4” Do i have to do anything special when I have my popups in a box? Thanks for any help.

-James

The error you are getting is caused by referencing an object that doesn’t exist at the location you’ve provided. When you place an object in a box, it is a valid container that must be part of your reference to the object. The following works for me…

tell popup button "myPopupButton" of box "myBox" of window "myWindow"
	set theItemName to name of current menu item
end tell

Remember that you must provide an AS name for every item in the list or you’ll get an error whenever an item is selected that doesn’t have a name. This will also work for getting the the “title” property or the “tag” property.

Good luck,
j

I had a feeling that might be it, but wasn’t sure how to implement the code. Thanks millions Jobu :slight_smile: