A dialog without a panel in Igor Pro
Prompt plus DoPrompt is a whole dialog in six lines, and it needs no window.
Function AskAndRun()
Variable width = 5
String method = "binomial"
String target = ""
Prompt width, "Smoothing window"
Prompt method, "Method", popup, "binomial;boxcar;median"
Prompt target, "Wave", popup, WaveList("*", ";", "")
DoPrompt "Smooth a wave", width, method, target
if (V_flag)
return -1
endif
Printf "%s smoothing of %s, window %d\r", method, target, width
return 0
End
How it works
- Each
Promptnames a variable and its label, in order. DoPromptshows them and setsV_flagto 1 if the user canceled.- A
Promptwith a list becomes a popup menu.
Keywords and builtins used here
DoPromptEndFunctionPrintfPromptStringVariableWaveListendififreturn
The run, in numbers
- Lines
- 17
- Characters to type
- 384
- Tokens
- 70
- Three-star pace
- 90 tpm
At the three-star pace of 90 tokens a minute, this run takes about 47 seconds.
Step 4 of 5 in Wiring it up, step 16 of 18 in Panels & GUI.