typestar

Checkboxes and radio buttons in Igor Pro

The same control does both: a shared mode makes a group exclusive.

Function AddChecks()
    CheckBox smoothChk, pos={16, 160}, title="Smooth first", value=1
    CheckBox smoothChk, proc=OptionToggled

    CheckBox linRadio, pos={16, 182}, title="Linear", value=1, mode=1
    CheckBox logRadio, pos={96, 182}, title="Log", value=0, mode=1
End

Function OptionToggled(STRUCT WMCheckboxAction &cba) : CheckBoxControl
    if (cba.eventCode != 2)
        return 0
    endif

    Printf "%s is %s\r", cba.ctrlName, SelectString(cba.checked, "off", "on")
    return 0
End

How it works

  1. value= is 0 or 1; variable= binds it to a global instead.
  2. mode=1 turns a set of checkboxes into radio buttons.
  3. The action's checked field is what changed.

Keywords and builtins used here

The run, in numbers

Lines
16
Characters to type
457
Tokens
114
Three-star pace
85 tpm

At the three-star pace of 85 tokens a minute, this run takes about 80 seconds.

Type this snippet

Step 4 of 5 in Values a user sets, step 7 of 18 in Panels & GUI.

← Previous Next →