Back

SetMenu

JS Py
Hello World

Set the app menu fields.

app.SetMenu( list, iconPath? )

When a menu entry is touched, the global OnMenu event will be called.

See Also: ShowMenu

Example - Example

function OnStart()
{
    app.SetMenu( "Start,Stop,Pause" );

    lay = app.CreateLayout( "linear", "" );

    btn = app.CreateButton( "[fa-gear]", -1, -1, "fontawesome" );
    btn.SetOnTouch( app.ShowMenu );
    lay.AddChild( btn );

    app.AddLayout( lay );
}

function OnMenu( item )
{
    app.ShowPopup( item, "Short" );
}
from native import app

def OnStart():
    app.SetMenu("Start,Stop,Pause")

    lay = app.CreateLayout("linear", "")

    btn = app.CreateButton("[fa-gear]", -1, -1, "fontawesome")
    btn.SetOnTouch(app.ShowMenu)
    lay.AddChild(btn)

    app.AddLayout(lay)

def OnMenu(item):
    app.ShowPopup(item, "Short")
    Copy     Copy All       Run      

Example - Menu Icons

function OnStart()
{
    menus = "Files:folder,Music:list,Images:picture";
    app.SetMenu( menus );

    app.ShowMenu();
}

function OnMenu( item )
{
    app.ShowPopup( item, "Short" );
}
from native import app

def OnStart():
    menus = "Files:folder,Music:list,Images:picture"
    app.SetMenu(menus)
    app.ShowMenu()

def OnMenu(item):
    app.ShowPopup(item, "Short")
    Copy     Copy All       Run      
String: comma “,” separated
String: path to file ( “/absolute/...” or “relative/...” )