Loading and Saving widget data

When a stack containing a widget is saved, the widget's OnSave handler is called by the engine. The OnSave handler has an array out parameter - you can fill this array with whatever widget data is needed to reconstruct the widget. LiveCode saves this data along with instances of the widget in the stack file.

public handler OnSave(out rProperties as Array) put the empty array into rProperties put mMargin into rProperties["margin"] return rProperties end handler

This same array is passed as a parameter to an OnLoad handler which is called when the stack the widget is on is loaded.

public handler OnLoad(in pProperties as Array) put pProperties["margin"] into mMargin end handler