ScriptSpot

Forum topic · General Scripting

problem with dropdownlist

By jmpinero · 2010-08-08

Description

hi! first excuse my English.
I am trying this.. one button print a string according item select on dropdownlist.

I used this:
_____________________________________________

rollout test "test"
(
dropdownlist list01 items:#("01","02", "03", "04")
button testPrint "print"
on testPrint pressed do
(
if LegsSolvers.items[1] selected do
(
print "Hello"
)
)
)
createdialog test
_____________________________________________

How I can do this?

Comments (1)

Anubis · 2010-08-08

Your dropdownlist is named 'list01' not 'LegsSolvers', so if you with to print "hello" then the 1st item in the list is selected:

rollout test "test"
(
    dropdownlist list01 items:#("01","02", "03", "04")
    button testPrint "print"
    
    on list01 selected idx do
        if idx == 1 do print "hello (from dropdownlist)"
    		
    on testPrint pressed do
    (
        if list01.selection == 1 do print "hello (from button)"
    )
)
createDialog test