DestroyLayout destroys a layout and all its contents so it can't be used any more.
Example - Destroy layout and check if deleted
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);
}
from native import app
def OnStart():
global lay
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 )
def btn_OnTouch():
app.DestroyLayout(lay)
text = this.GetText() or "nothing in here!"
app.ShowPopup(text)