problem with dropdownlist

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Anubis's picture

Your dropdownlist is named

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

my recent MAXScripts RSS (archive here)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.