Back

SetPosition

JS Py
Hello World

Change the main app's position and size.

app.SetPosition( left, top, width=-1, height=-1, options? )

Mostly used for transparent apps.

Example - SetPosition

function OnStart()
{
    app.SetPosition( 0.2, 0.2, .6, .6 );

    lay = app.CreateLayout( "linear", "VCenter,fillxy" );
    lay.SetBackColor("blue")

    btn = app.CreateButton( "Hello World", 0.3, 0.1 ); // 1, 1 will overflow
    lay.AddChild( btn );

    app.AddLayout( lay );
}
from native import app

def OnStart():
    app.SetPosition(0.2, 0.2, .6, .6)

    lay = app.CreateLayout("linear", "VCenter,fillxy")
    lay.SetBackColor("blue")

    btn = app.CreateButton("Hello World", 0.3, 0.1)
    lay.AddChild(btn)

    app.AddLayout(lay)
    Copy     Copy All       Run      
Number: fraction (0..1)
String: “px”