'Maxscript Radiobutton and button comand

I want to ask how does this work? in the "box" option then pressing the DO button will create a box. I really appreciate any reply, thank you

rollout createobj "creatingobj" width:235 ( radiobuttons radmix "Create:" pos:[8,8] width:58 height:110 labels: #("box", "spehere", "cone", "cylinder", "geospehre", "plane") columns:1 offsets:#([0,0], [0,0], [0,0], [0,0], [0,0], [0,0]) align:#left button btnmix "Do" pos:[136,16] width:94 height:104 align:#left ) createDialog createobj



Solution 1:[1]

It won't because there's no handler for the button. You should read the Scripted Utilities and Rollout section of the reference and learn from that, there are many commented examples scattered throughout. Also, when posting code, use the Code button (or indent the codeblock manually). Here's a working code:

rollout createobj "creatingobj" width:235
(
    local items = #("box", "sphere", "cone", "cylinder", "geosphere", "plane")
    radiobuttons radmix "Create:" pos:[8,8] width:58 height:110 labels:items columns:1 align:#left
    button btnmix "Do" pos:[136,16] width:94 height:104 align:#left
    on btnmix pressed do (execute items[radmix.state])()
)
createDialog createobj

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Swordslayer