Back

ShowKeyboard

JS Py
Hello World

Shows the keyboard on a focussed control.

app.ShowKeyboard( obj ) → Boolean

See Also: HideKeyboard

Example - Basic

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

    edt = app.CreateTextEdit( "Hell World" );
    edt.Focus();
    lay.AddChild( edt );

    app.AddLayout( lay );

    app.ShowKeyboard( edt );
}
from native import app

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

    edt = app.CreateTextEdit("Hello World")
    edt.Focus()
    lay.AddChild(edt)

    app.AddLayout(lay)

    app.ShowKeyboard(edt)
Copy All       Run      

Example - Toggle Keyboard

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

    tgl = app.CreateToggle( "Keyboard", 0.3, 0.1 );
    tgl.SetOnTouch( tgl_OnTouch );
    lay.AddChild( tgl );

    edt = app.CreateTextEdit( "Text", .8, .1 );
    edt.Focus();
    lay.AddChild(edt);

    app.AddLayout( lay );
}

function tgl_OnTouch( show )
{
    if( show ) app.ShowKeyboard( edt );
    else app.HideKeyboard();

}
from native import app

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

    tgl = app.CreateToggle("Keyboard", 0.3, 0.1)
    tgl.SetOnTouch(tgl_OnTouch)
    lay.AddChild(tgl)

    edt = app.CreateTextEdit("Text", .8, .1)
    edt.Focus()
    lay.AddChild(edt)

    app.AddLayout(lay)

def tgl_OnTouch(show):
    if show:
        app.ShowKeyboard(edt)
    else:
        app.HideKeyboard()
    Copy     Copy All       Run      
app object