Correction: it turns out the code below does work - my error was elsewhere in my code. Thanks for the help Woodenbrain!
I’ve been having a problem that’s been reported on these boards several times, and I have tried the suggested solutions.
I have a drop-down list on each of two tabs. I would like to disable the list programmatically.
I have tried the two solutions below. The first just tries to reset the list by referencing it directly, the second tries to reset the list through reference objects created during awake from nib. Both set the current tab before trying to manipulate the list, but neither actually disables the list.
referencing directly:
on resetInterface()
tell tab view "MyTabView" of window "main"
set the current tab view item of tab view¬
"MyTabView" of window "main" to tab view item¬
"tab2"
delete every menu item of menu of popup button¬
"itemList" of view of tab view item "tab2" of¬
tab view "MyTabView" of window "main"
make new menu item at the end of menu items of¬
menu of popup button "itemList" of view of tab¬
view item "tab2" of tab view "MyTabView" of¬
window "main" with properties {tag:0,¬
title:"Select an item", enabled:true}
tell popup button "itemList" of tab view item¬
"tab2" of tab view "MyTabView" of window¬
"main" to set visible to false
end tell
end resetInterface
awake from nib reference:
on awake from nib theObject
if the name of theObject is "itemList" then
set itemList to theObject
end if
end awake from nib
on resetInterface()
tell tab view "MyTabView" of window "main"
set the current tab view item of tab view¬
"MyTabView" of window "main" to tab view item¬
"tab2"
delete every menu item of menu of itemList
make new menu item at the end of menu items of¬
menu of itemList with properties {tag:0,¬
title:"Select an item", enabled:true}
tell itemList to set visible to false
end tell
end resetInterface