ScriptSpot

Forum topic · General Scripting

Second Rollout Floater doesn't open properly.

By matheyrhio · 2019-09-07

Description

Hi Guys, I'm still new to MaxScript and generally I find my answer on the web to debug my mess. This one tho I can't find where the bug is.

I just want to open a second rollout floater with a button from my first rollout floater using try (closerolloutfloater myfloater) catch() to avoid copies of the rollout floater.


Rollout mySecondRollout "mySecondRollout"
(
Label lbl_01 "SecondFloater"
)

Rollout myRollout "myRollout"
(
button btn_01 "Open Second Floater" pos:[2,6] width:200 height:20

on btn_01 pressed do
(
try (closerolloutfloater SecondFloater) catch() --not working !
SecondFloater = newrolloutfloater "SecondFloater" 500 200
addrollout mySecondRollout SecondFloater
)
)

FirstFloater = NewRolloutFloater "FirstFloater" 300 400
addRollout myRollout FirstFloater

Comments (1)

Swordslayer · 2019-09-11

The variable SecondFloater exists only in the btn_01 pressed handler scope, you need to predeclare it:

Rollout myRollout "myRollout"
(
	local SecondFloater  --> add this line
	button btn_01 "Open Second Floater" pos:[2,6] width:200 height:20