Notifications
Clear all

[Closed] AddSubRollout

struct testSt
(
	fn ui =
	(
		rollout test1 "test1"
		(
			subrollout sr1 height:100
			button addSRBt "add"
			
			on addSRBt pressed do 
			(
				testSt.addSR()
			)
		)
	
		rollout test2 "test2"
		(
			spinner sp
		)
		
		createDialog test1
	),
	
	fn addSR =
	(
		addSubRollout test1.sr1 test2
	)
)

testSt.ui()

This gives an error that test2 is undefined, how do I get it to see the second rollout?

5 Replies

before asking the question have you tried to search on this forum?

I have, and found no solution.


struct TheDialog
(
	main,
	subA, subB,
	fn isRollout rol = (iskindof rol RolloutClass),
	fn mainRollout = rollout main "Main" width:200 height:200
	(
		subrollout sub height:120
	),
	fn subRolloutA = rollout subA "Sub A"
	(
		label lb "Sub Rollout A"
	),
	fn subRolloutB = rollout subB "Sub B"
	(
		label lb "Sub Rollout B"
	),
	fn create show:on =
	(
		mainRollout()
		subRolloutA()
		subRolloutB()
		if show do createDialog main
	),
	fn show = if isRollout main do
	(
		createDialog main
	),
	fn addSub sub = if isRollout main and isRollout sub do
	(
		addSubRollout main.sub sub
	),
	fn removeSub sub = if isRollout main and isRollout sub do
	(
		removeSubRollout main.sub sub
	),
	fn close = if isRollout main do
	(
		destroydialog main
	)
)
myDialog = TheDialog()
myDialog.create()
/*
-- #1
myDialog.addSub myDialog.subA
-- #2
myDialog.addSub myDialog.subB
-- #3
myDialog.removeSub myDialog.subA
-- #4
myDialog.close()
-- #5
myDialog.show()
*/

Thank you, I finally got it working but it took some deciphering since you didn’t really explain the script you posted.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i don’t explain the code. ask questions, i will answer. you asked for code, i gave it. if you want to use it try to understand how it works.