Notifications
Clear all

[Closed] Help with Rollout Creator

Hi I’m trying to get to grips with the rollout creator but I’m finding it very confusing. I’ve created this example script.

How would I actually access the values from the rollout?
How do I detect the rolledUp state of a dynamically created rollout so I can adjust the layout?

Any help would be hugely appreciated.

rollout main "Main Window" --width:300 height:700
(
	-- UI Layout --
	subrollout subrollout1 "mainRollout1" height: 300 --height is the initial size of the open dialog This is the order it will be placed in the window
	group "A group"
	(button btnPrint "Print Contents" )
	
	-- Variables --
	local numInputs = 10
	local inputStrings = #()
	
	--populate the main windows rollouts on creation
	on main open do
	(	   
		--Create the dynamic rollout      
		rci = rolloutCreator "rollout1" "The first rollout title" --height:400 --Create a rollout named rollout1 stored in rci
		rci.begin() 
		for i = 1 to numInputs do
		(
			local nname = ("inputFeild_"+ (i as string)) as name --Create the name of the UI element variable
			rci.addControl #edittext nname ("Input: " + i as string) paramStr:"text:\"Input some data\" width: 150 across: 2" --Create the UI element
			
			inputStrings[i] = nname
				
			local nname = ("bn_"+ (i as string)) as name
			rci.addControl #button nname ("Button " + i as string) paramStr:"align:#right"	
		)
		rci.end() 
		AddSubRollout main.subrollout1 rollout1 			--Actually add the rollout			
	)
	
	on btnPrint pressed do
	(
		print "Printing..."
		print inputStrings[1]
	)
	
	on rollout1 rolledUp state do
	(
		if state then
		(
			print "rollout1 Rolled Down"
			--rollout2.height = 100
		)
		else(
			print "rollout1 Rolled Up"
			--rollout2.height = 400
		)
	)
)
createdialog main width:300