Enabling and disabling in Igor Pro
Every control takes disable, and using it is how a panel explains itself.
Function SyncPanel()
ControlInfo/W=AnalysisPanel smoothChk
Variable smoothing = V_value
Button runBtn, win=AnalysisPanel, disable=(smoothing ? 0 : 2)
SetVariable thrSet, win=AnalysisPanel, disable=(smoothing ? 0 : 2)
ControlUpdate/W=AnalysisPanel thrSet
DoUpdate/W=AnalysisPanel
End
How it works
disable=0is normal, 1 hides it, 2 grays it out.- Gray out what cannot apply yet rather than letting it fail.
ControlUpdateredraws one control after its backing value changed.
Keywords and builtins used here
ButtonControlInfoControlUpdateDoUpdateEndFunctionSetVariableVariable
The run, in numbers
- Lines
- 10
- Characters to type
- 284
- Tokens
- 55
- Three-star pace
- 90 tpm
At the three-star pace of 90 tokens a minute, this run takes about 37 seconds.
Step 2 of 5 in Wiring it up, step 14 of 18 in Panels & GUI.