[Closed] Attaching a Rollout to another Rollout
i have a GUI with a button and label…on button pressed it creates another GUI right below it…my doubt is how can i make the second rollout move together with my first rollout…like the second one is attached to the first one
try destroydialog test catch()
try destroydialog test2 catch()
rollout test ""
(
label lbl "This is a Test"
button btn "Press Me"
on btn pressed do
(
rollout test2 "test"
(
button btn "button"
)
createdialog test2
setdialogpos test2 [758,556]
)
)
createdialog test
you can add an
on <rollout> moved <val> do
event to the rollout, or both of them, moving the other rollout relatively to the new position.
I made like this but i get a error saying: “>> MAXScript Rollout Handler Exception: – Unknown property: “position” in Rollout:test2 <<”
if i change the test2.position to messagebox “anything” it shows that message
try destroydialog test catch()
try destroydialog test2 catch()
rollout test ""
(
label lbl "This is a Test"
button btn "Press Me"
on test moved position do
test2.position
on btn pressed do
(
rollout test2 "test"
(
button btn "button"
)
createdialog test2
setdialogpos test2 [758,556]
)
)
createdialog test
what i want is when i press the “press me” button, i want the test2 rollout already attached to the first one…so when i drag the first rollout anywhere in the screen, second rollout will follow it
try destroydialog test catch()
try destroydialog test2 catch()
rollout test "" height:100
(
label lbl "This is a Test"
button btn "Press Me"
on test moved pos do setDialogPos test2 (pos+[0,test.height+20])
on btn pressed do
(
rollout test2 "test"
(
button btn "button"
)
createdialog test2 pos:[(getDialogpos test)[1],(getDialogPos test)[2]+test.height+20]
)
)
createDialog test
am getting this error when i move the first rollout:
MAXScript Rollout Handler Exception: – Type error: SetDialogPos requires RolloutClass, got: undefined
try destroydialog test catch()
try destroydialog test2 catch()
rollout test "" height:100
(
label lbl "This is a Test"
button btn "Press Me"
on test moved pos do setDialogPos test2 (pos+[0,test.height+20])
on btn pressed do
(
rollout test2 "test"
(
button btn "button"
)
createdialog test2 pos:[(getDialogpos test)[1],(getDialogPos test)[2]+test.height+20]
)
)
createDialog test
that is because you are defining test2 only when you press the button
so either define test2 before defining test1 or change:
on test moved pos do
(
if test2!=undefined and test2.open do setDialogPos test2 (pos+[0,test.height+20])
)