Second Rollout Floater doesn't open properly.

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

Comment viewing options

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

 

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

Comment viewing options

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