Back

SetOrientation

JS Py
Hello World

Set the display orientation to a fixed value.

app.SetOrientation( orient, callback? )

You can unlock it again passing “Default” as orientation.

See Also: GetOrientation

Example - Change Orientation

function OnStart()
{
    lay = app.CreateLayout( "linear", "VCenter,FillXY" );

    spn = app.CreateSpinner( "Default,Landscape,ReverseLandscape,Portrait,ReversePortrait", 0.3, 0.1 );
    spn.SetOnChange( SetOrientation );
    lay.AddChild( spn );

    app.AddLayout( lay );
}

function SetOrientation( orient )
{
    app.SetOrientation( orient )
}
from native import app

def OnStart():
    lay = app.CreateLayout( "linear", "VCenter,FillXY" )

    spn = app.CreateSpinner( "Default,Landscape,ReverseLandscape,Portrait,ReversePortrait", 0.3, 0.1 )
    spn.SetOnChange( SetOrientation )
    lay.AddChild( spn )

    app.AddLayout( lay )

def SetOrientation( orient, index):
    app.SetOrientation( orient )
    Copy     Copy All       Run      
String: “Default” or “Landscape” or “ReverseLandscape” or “Portrait” or “ReversePortrait”
function()