PDA

View Full Version : Attaching a Rollout to another Rollout


patriculus
01-31-2011, 03:43 PM
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

lo
01-31-2011, 04:54 PM
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.

patriculus
01-31-2011, 06:13 PM
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

lo
01-31-2011, 07:14 PM
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

patriculus
02-01-2011, 10:36 AM
Thank you LO :)

patriculus
02-02-2011, 04:44 PM
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

lo
02-02-2011, 05:09 PM
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])
)

patriculus
02-02-2011, 05:37 PM
Thanks LO...:)

CGTalk Moderation
02-02-2011, 05:37 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.