Reoccurring Dialog

How would I go about creating a dialog the continuously creates a rollout until the numbered limit is up, or if the user hits Cancel the whole operation is terminated.

fn fnCounter = (
for i = 1 to 4 do
(
global loopCount = i

rollout rlCool ""
(
button btnGo "GO"
button btnCancel "Cancel"
label lbLoopCounter "1"

on rlCool open do
(
lbLoopCounter.text = loopCount as string
)
)
createDialog rlCool 150 150
)
)
clearlistener()
fnCounter()

Comments

Comment viewing options

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

Thanks

Thanks guys for the examples I'll go ahead and try these out and see what works best for my situation.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

JokerMartini's picture

I would want it to

I would want it to progressive execute. Not all at once. So if the user says ok to the first rollout it then creates the second and so forth. but if they hit cancel at any point it just stops.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

...

for i = 1 to countLimit while \
not keyboard.escPressed do
(
	-- build the rollout as string
	strDefinition = ...
	-- and execute
	execute strDefinition
)

and if the question is how to abort the process by pressing btnCancel inside your rollouts, then just use global variable:

on btnCancel pressed do
(::ACT_CANCELED = true)

...and your for-loop w'd become something like:

global ACT_CANCELED = false
for i = 1 to 4 while not ACT_CANCELED do...

my recent MAXScripts RSS (archive here)

LittleLordPotala's picture

You can also use two scripts

1) Copy both scripts in your current script folder
2) launch "test0.ms"
3) click "Go" button
4) if you want to cancel, you can hold down the ESC key

AttachmentSize
test0.ms 266 bytes
test1.ms 260 bytes
miauu's picture

for i = 1 to 4

for i = 1 to 4 do
	(
		rol_Name = "rlCool" + (i as string)
		str = "rollout " + rol_Name+ " \"\" ("
		str += "button btnGo \"GO\""
		str += "button btnCancel \"Cancel\""
		str += "label lbLoopCounter \"1\""
		str += "on rlCool open do lbLoopCounter.text = loopCount as string"
		str += ")"
		str += "createDialog " + rol_Name+" 150 150"
		execute str
	)
	clearlistener()
[code]

Comment viewing options

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