CheckBoxes

Create CheckBoxes using the CreateCheckBox function of the app object:

 chk = app.CreateCheckBox( text );

Use the SetOnTouch function of the CheckBox 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