Back

GetKeyboardHeight

JS Py
Hello World

Returns the height of the device keyboard in pixels.

app.GetKeyboardHeight() → Number: pixel

Returns 0 if the keyboard is hidden.

See Also: ShowKeyboard

Example - Show Keyboard Height

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

    txt = app.CreateText( "Keyboard Height: ", .8, -1, "left" );
    lay.AddChild( txt );

    edt = app.CreateTextEdit( "Hello World", .8, .4 );
    lay.AddChild( edt );

    app.SetOnShowKeyboard( OnKeyboardShow );

    app.AddLayout( lay );
}

function OnKeyboardShow()
{
    var height = app.GetKeyboardHeight();
    txt.SetText( "Keyboard Height: " + height + "px" );
}
from native import app

def OnStart():
    global txt
    lay = app.CreateLayout("linear")

    txt = app.CreateText("Keyboard Height: ", .8, -1, "left")
    lay.AddChild(txt)

    edt = app.CreateTextEdit("Hello World", .8, .4)
    lay.AddChild(edt)

    app.SetOnShowKeyboard(OnKeyboardShow)

    app.AddLayout(lay)

def OnKeyboardShow(shown):
    height = app.GetKeyboardHeight()
    txt.SetText("Keyboard Height: " + str(height) + "px")
    Copy     Copy All       Run