Back

ListDialog

You can create a dialog box to display a list in your App using the CreateListDialog method of the app object:

 dlg = app.CreateListDialog( title, list, options );

Use the SetOnTouch method of the ListDialog object to set the name of a function you want to be called when a list item is selected. The selected item is passed into your OnTouch callback function as parameters every time an item is selected.

Example

function OnStart()
{
    dlg = app.CreateListDialog( "Choices", "Add,Remove,Delete" );
    dlg.SetOnTouch( dlg_OnTouch );
    dlg.Show();
}

function dlg_OnTouch( item )
{
    app.ShowPopup( item );
}
    Copy     Copy All      Run     

You can use the "Multi" option to create a ListDialog with check boxes against each item. This allows multiple list items to be selected. An extra parameter isChecked is passed to the OnTouch callback function when a check box is checked or unchecked.

When using the "Multi" option, the ListDialog can be dismissed using the back button on the phone or tablet.

Example - Multi

function OnStart()
{
    dlg = app.CreateListDialog( "Days", "Mon,Tues,Wed,Thurs,Fri,Sat,Sun", "Multi" );
    dlg.SetOnTouch( dlg_OnTouch );
    dlg.Show();
}

function dlg_OnTouch( item, isChecked )
{
    app.ShowPopup( item + " isChecked = " + isChecked );
}
    Copy     Copy All      Run     

See 'CreateListDialog for more informations and a complete function list