Saving Cloned Objects

Saving dynamically created objects

I'm creating a widget that based on some actions of the user creates new objects, I do this by cloning a template object that is hidden. The problem I'm having is that when I close the widget, it doesn't remember all those new objects it created and when I open it again they are gone.
Those objects, while not very complex, do have a number of parameters that they need stored and so using something like Local/PersistStorage to save each object's parameters and then essentially recreate them when the widget runs again seems awfully inefficient. Is there a way to save the state of the widget together with all its children (the new objects are parented to the main object)? Or perhaps I can store an entire object in local storage, is that possible?
2,303 views 3 replies
Reply #2 Top
I've never tried something like that but, have you tried experimenting with giving the widget and all its children the same widget name as displayed on the summary tab loacted on the porperties panel and then executing a save widget command in script. It seems logically that would work. But as a practicle matter I don't know how that could be scripted (the save widget command) Vad_M would probably know how. Try sending him an email.  
Reply #3 Top
I see a single way to do this. Your "Main" widget must create the "INI" file where it can save all information about cloning objects (their count, position etc...) before its closing. You need use File System Object (FSO) for this. In this case your widget will read this file at the next start and clone the same objects.

Have a Nice Day.