genSwitch function

Widget genSwitch (
  1. SamModel sm,
  2. String sym,
  3. Object label,
  4. {bool defValue: false,
  5. CheckFunc changeExec}
)

Return an on/off switch widget

This is used to create an on/off switch widget. When the switch changes value the changeExec function if it exists will be called.

The defValue is the initial value and assumes it matches the SamHot sym setting. This can be guaranteed by specifying defValue:sm.getHot(sym) and making sure the SamHot value of sym in sm has a true or false value.

The label adds a label to the switch.

Implementation

Widget genSwitch(SamModel sm,String sym,Object label,{bool defValue = false,CheckFunc changeExec}) {
  return _LabeledSwitch(sm,sym,label,defValue,changeExec);
}