Back

GetKeyboardHeight

Hello World

Returns the height of the device keyboard in pixels.

app.GetKeyboardHeight() → string: integer in pixels

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" );
}
    Copy     Copy All       Run