popup button item disabling

i want to disable a popup button item, when an item in a different popup button is selected. how do i do that, what handlers should i use? thanks.

Popup buttons can respond to choose menu item events, so you would select that in Interface Builder and select the script you want the event forwarded to (at the bottom of the Inspector window). Then put this handler (adapted to your object names) in that script

on choose menu item(theObject)
--check to see if it is the popup button
    if name of theObject is "myPopupButton" then --use whatever name your popup button uses
        if the title of theObject is "deactive menu" then --use the menu item title that you want to deactivate the menu
            set the enabled of theObject to false
        end if
    end if
end choose menu item

I think that’s right, I’m doing this off-the-cuff.

hm…didnt work, no errors, nothing happens.

bump

Make sure you’ve given the popup button an Applescript name in the Inspector window in Interface Builder.

Can you post the code you’re using and perhaps a screen capture of the item in Interface Builder? With the Inspector window info?

actually i just figured it out. thanks guys. heres what i did.

on choose menu item theObject
	if name of theObject is "popup" then
		tell popup button "dowhat" of window "main"
			if the title of theObject is "blah" then
				set auto enables items to false
				set enabled of menu item "itunes" to false
			else
				set enabled of menu item "itunes" to true
			end if
		end tell
	end if
end choose menu item