Notifications
Clear all

[Closed] Passing labels array to radioButtons in RolloutCreator

Hi all,

I’m adding radiobuttons to a dynamic rollout, called rci

I’ve been able to add other UI controls, but radiobuttons are giving me some trouble. I’m having difficulty with passing the array of strings for the button labels.

I’ve tried several different methods, including:

sEven = "even" 
sOdd = "odd" 
alternateradio_params = ("width:150 labels:#(sEven,sOdd) enabled:false default:1") 
alternateradio_control = ("alternateradio_RAD") 
alternateradio_text = ("Every other") 
rci.addControl #radiobuttons alternateradio_control alternateradio_text paramStr:alternateradio_params

At which point I get a compiler error for sEven and sOdd being undefined.

I’ve also tried just concatenating the paramStr string, by doing:

labels:#("+("Even" as string)+","+("Odd" as string)+")"

Which also doesn’t work… I have a feeling I’m missing something very simple here. Basically I just need to know how to pass an array of strings inside a string!

Here is the documentation on addControl() for dynamic rollouts, which I’ve been reading but unfortunately only provides a very basic button example:
http://www.kxcad.net/autodesk/Autodesk_MAXScript_Reference_9/RolloutCreator_Functions.htm

Thank you in advance

2 Replies
 lo1

read up on ‘string literals’ in the maxscript help file.

Basically to include a ” character inside a string you have to escape it, which means add a backslash in front of it:

"this is called \"escaping\" a string"

… which means:


 rc = rolloutCreator "theRollout" "The Rollout"
 rc.begin()
 rc.addControl #radiobuttons #type_rb "Type:" paramStr:"labels:#(\"Fast\", \"Slow\")"
 createDialog (rc.end())