Reading a control in Igor Pro
ControlInfo asks a control what it holds, without keeping a copy yourself.
Function ReadPanel()
ControlInfo/W=AnalysisPanel thrSet
Variable threshold = V_value
ControlInfo/W=AnalysisPanel waveSel
String chosen = S_value
ControlInfo/W=AnalysisPanel smoothChk
if (V_flag == 0)
Print "no such control"
return -1
endif
Printf "%s at %g, smoothing %d\r", chosen, threshold, V_value
return 0
End
How it works
- It fills
V_value,S_valueandS_dataFolderin the local scope. V_flagsays what kind of control it found, or zero for none.- It is the way to read one control from another control's action.
Keywords and builtins used here
ControlInfoEndFunctionPrintPrintfStringVariableendififreturn
The run, in numbers
- Lines
- 16
- Characters to type
- 317
- Tokens
- 50
- Three-star pace
- 90 tpm
At the three-star pace of 90 tokens a minute, this run takes about 33 seconds.
Step 1 of 5 in Wiring it up, step 13 of 18 in Panels & GUI.