[Closed] Keep rollout data when closing ?
Hello all !
Suppose I have a simple rollout :
rollout my_rollout "My Rollout" (
spinner my_value "value :" range:[-180,180,0]
local myAttribute
on my_value changed newValue do (
print my_value.value
)
)
I create a floater and put the rollout in it :
myFloater = newRolloutFloater "My Floater" 150 220
addRollout my_rollout myFloater
Now my problem is I would like to be able to close the floater and re-open it without losing my changes. If I do this :
my_rollout.myAttribute = "NEW VALUE"
closeRolloutFloater myFloater
myFloater = newRolloutFloater "My Floater" 150 220
addRollout my_rollout myFloater
Then my rollout re-appears but everything is reset…
Am I doing something wrong ?
I could do it with global variables but I do not like it (they all have to be prefixed,…)
Thanks in advance !
Yannick
When you close the sub-rollot(or any rollout) store(save) the settings in ini file. When you open it – load the settings from the ini file. Do not use global variables.
Mm actually I meant I want to reuse the rollout so I don’t have to store and re-inject the values at all :)(either through global variables or ini files)
Use a dotnet form instead and override its OnClosing event. Inside the event handler change the eventarg’s cancelled property to true and .Hide() the form manually.
You can do something similar with maxscript rollouts using the okToClose event but it’s less elegant as you can only minimize the form, not really hide it, unless you get all fancy with a win32 ShowWindow method, and even then, you’d be responsible for checking if the window is hidden or not when the user relaunches the tool.