[Closed] destroyDialog & callback
Hello,
My questions is:
Is there a way to capture the destruction of a dialog ?
If I close the settings dialog before unchecking the checkbutton the callback stays active.
– edited
after thinking awhile, I guess a possible answer is:
eachtime the callback executes, check for the existance of the dialog and if the dialog got disapeared remove the callback. I will check this tomorrow.
– edited
My script sets vertices in Editable_Poly Objects to a specified offset.
After executing the script you can specify the offset and enable the tool.
The first selected vertex is the “base”. Select on or more vertices and they will get the absolute offset to the first selected.
The tool restarts itself while the checkbutton is active.
regards,
Georg
You could also try “on <rollout> close do ( );” which will call the functions inside the “()”’s when the rollout is destroyed.
I have a “on close” in my script. But it doesn’t trigger.
I made a sample script and it triggert, but you could open the dialog many times as something else went wrong.
I found this sample by Bobo, wich only allows on instance of a dialog, but after inserting my close event the event doesn’t trigger!
( --start local scope (could be the body of a macroScript...)
-- global myDialog --declare the variable to store the rollout for the dialog
try(destroyDialog myDialog)catch() --try to destroy a dialog from previous session
rollout myDialog "Dialog" --define the content of the dialog's rollout
(
button myButton "Press Me!"
on myButton pressed do destroyDialog myDialog
-- > inserted this event
on myDialog closed do print "just closed myDialog"
)
createDialog myDialog 200 200
)--end local scope
btw is there a pattern archive for maxScript?
Georg
try taking out the ‘d’ in closed
try(destroyDialog myDialog)catch() --try to destroy a dialog from previous session
rollout myDialog "Dialog" --define the content of the dialog's rollout
(
button myButton "Press Me!"
on myButton pressed do destroyDialog myDialog
-- > inserted this event
on myDialog close do print "just closed myDialog"
)
createDialog myDialog 200 200