Sliders in Igor Pro
A slider is a SetVariable you can drag, and it reports continuously unless told not to.
Function AddSlider()
Slider widthSlider, pos={16, 44}, size={200, 50}
Slider widthSlider, limits={1, 51, 2}, value=5, live=0
Slider widthSlider, vert=0, ticks=5, proc=WidthMoved
End
Function WidthMoved(STRUCT WMSliderAction &sa) : SliderControl
if ((sa.eventCode & 1) == 0)
return 0
endif
NVAR window = root:Settings:gWindow
window = round(sa.curval)
Printf "window %d\r", window
return 0
End
How it works
limits={low, high, increment}andvariable=are the essentials.live=0waits for the mouse to come up before reporting.- The action's
curvalis the value, andeventCodesays why it fired.
Keywords and builtins used here
EndFunctionNVARPrintfSTRUCTSliderendififprocreturnroundtickswindow
The run, in numbers
- Lines
- 16
- Characters to type
- 394
- Tokens
- 105
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 74 seconds.
Step 5 of 5 in Values a user sets, step 8 of 18 in Panels & GUI.