Popup menus in Igor Pro
A popup's list can be a literal string or an expression evaluated when it opens.
Function AddPopup()
PopupMenu waveSel, pos={16, 132}, size={220, 20}, title="Wave"
PopupMenu waveSel, value=#"WaveList(\"*\", \";\", \"\")"
PopupMenu waveSel, mode=1, proc=WavePicked
End
Function WavePicked(STRUCT WMPopupAction &pa) : PopupMenuControl
if (pa.eventCode != 2)
return 0
endif
WAVE/Z chosen = $pa.popStr
if (WaveExists(chosen))
Printf "%s: %d points\r", pa.popStr, numpnts(chosen)
endif
return 0
End
How it works
value=starting with#is a string expression, re-read on each open.mode=is the one-based selection;popvalue=sets it by text.- The action gets
popStrandpopNum.
Keywords and builtins used here
EndFunctionPopupMenuPrintfSTRUCTWAVEWaveExistsendififnumpntsprocreturn
The run, in numbers
- Lines
- 17
- Characters to type
- 414
- Tokens
- 94
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 66 seconds.
Step 3 of 5 in Values a user sets, step 6 of 18 in Panels & GUI.