Back

CheckBoxes

Create CheckBoxes using the CreateCheckBox method of the app object:

 chk = app.CreateCheckBox( text );

Use the SetOnTouch method of the CheckBox object to set the name of a function you want to be called when the CheckBox is touched. You can read the 'isChecked' parameter in your callback function to get the state of the CheckBox

Example

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

    chk = app.CreateCheckBox( "Enable Stuff" );
    chk.SetOnTouch( ShowState );
    lay.AddChild( chk );

    app.AddLayout( lay );
}

function ShowState( isChecked )
{
    app.ShowPopup( "Checked = " + isChecked, "Short" );
}
    Copy     Copy All      Run     

See 'CreateCheckBox for more informations and a complete function list