Back

EnableBackKey

JS Py
Hello World

Allows to en- or disable the devices back key.

app.EnableBackKey( enable )

When it is disabled the global OnBack app event will called when the user presses the back button - otherwise the app exits.

You can use this method to create a custom BACK command that allows you to navigate between your layouts.

Example - Example

function OnStart()
{
    app.EnableBackKey( false );
}

function OnBack()
{
    var yesNo = app.CreateYesNoDialog( "Exit App?" );
    yesNo.SetOnTouch( yesNo_OnTouch );
    yesNo.Show();
}

function yesNo_OnTouch( result )
{
    if( result=="Yes" ) app.Exit();
}
def OnStart():
    app.EnableBackKey( false )

def OnBack():
    yesNo = app.CreateYesNoDialog( "Exit App?" )
    yesNo.SetOnTouch( yesNo_OnTouch )
    yesNo.Show()

def yesNo_OnTouch( result ):
    if result=="Yes" : app.Exit()
    Copy     Copy All       Run      
Boolean