User Tools

Site Tools


Privacy Policy


Version 2.50 is out since Jan 1st 2022

Frequently Asked Questions


Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax


Slide Menu

You can swipe left to close this menu.

var layMenu,txe;
//Called when application is started.
function OnStart()
    //container layout
    var layApp=app.CreateLayout("Absolute");
    //home layout
    var layHome=app.CreateLayout("Linear","Left,FillXY");
    var btnMnu;
    btnMnu=app.CreateButton("[fa-bars]", -1, -1, "fontawesome,custom");
    btnMnu.SetStyle( "#77bb77", "#559955", 15, "#449944",2,0 );
    txe =app.CreateTextEdit("aaaaa\nbbbbb",0.9,0.8);
   //Create menu layout
    layMenu = getSlideMenu(menu_OnTouch, menu_SwipeTest);    
    //Populate menu list
    //Add layout to app.    
    layApp.AddChild( layMenu );
function mnuAnimate()
function OnBack()
   else app.Exit();
//catch hardware menu button
function OnMenu( item )
    if(item==null) mnuAnimate();
function getSlideMenu(onTouch, swipeTest)
//Create menu layout
    var lst
    var layMenu = app.CreateLayout( "Absolute", "" );    
    //Create menu list
    lst = app.CreateList( "" ,0.8,0.8);
    if(onTouch) lst.SetOnTouch(onTouch);
    layMenu.AddChild( lst );
    //create swiper image
    var img=app.CreateImage(null,0.8,0.8);;
    if(swipeTest) img.SetOnTouch(swipeTest);
    //public methods
    layMenu.AddItem=function( title,body,image )
        lst.AddItem( title,body,image );
    layMenu.Setlist=function( list,delim )
        lst.SetList( list,delim )
    return layMenu
// callback function for menu selection
function menu_OnTouch( title, body, image, index )
  var s = txe.GetText()+"\n"+title;
  app.ShowPopup(title+" added")
// callback function to swipe close menu
function menu_SwipeTest(ev)
        if(ev.X-this.downX < -0.1)
sample_code/slide_menu.txt · Last modified: 2019/03/02 11:42 (external edit)