View Full Version : loop in rollout?

02 February 2006, 12:45 AM
I'm trying to get a rollout to make a list of buttons based on an array. At the moment I am getting an error :-

-- Syntax error: at for, expected <rollout clause>
-- In line: for 1

Does this mean that you can't place loops within a rollout definition? If so, is there a workaround that allows you to make a rollout that builds a list of options based on the number of items selected..... like the light lister.

Am I forced to use the rolloutcreator?

02 February 2006, 02:15 AM
Haha oops, didn't realize you mentioned rolloutCreator already. But yea I think that's the only way.

02 February 2006, 02:51 PM
You don't have to use RolloutCreator, but I think it pretty much does the same thing as I'm about to example anyway. RolloutCreator just puts all of this into a nice workable struct.

str = "rollout ro_test \"Test\" (\n"

for i = 1 to 5 do (
-- UI Declaration
str += "button bt_" + i as string + " \"Button_" + i as string + "\"\n"

-- Event handlers
str += "on bt_" + i as string + " pressed do (\n"
str += "messagebox \"You pressed button " + i as string + "\"\n"
str += ")\n"
str += ")\n"

createDialog (execute str) width:300 height:200

That should work.

CGTalk Moderation
02 February 2006, 02:51 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.