Back

DestroyLayout

Hello World

DestroyLayout destroys a layout and all its contents so it can't be used any more.

app.DestroyLayout( layout )

As a result, all memory occupied by these objects will be released.

See Also: CreateLayout, AddLayout

Example - Destroy layout and check if deleted

//Called when application is started.
function OnStart()
{
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );

    btn = app.CreateButton( "Don't Press Me", 0.3, 0.1 );
    btn.SetOnTouch( btn_OnTouch );
    lay.AddChild( btn );

    app.AddLayout( lay );
}

function btn_OnTouch()
{
    app.DestroyLayout(lay);

    var text = this.GetText() || "nothing in here!";
    app.ShowPopup(text);
}
    Copy     Copy All       Run      
app object: Layout