Tabs in Igor Pro
A tab control is one control plus the discipline of hiding the other pages yourself.
Function AddTabs()
TabControl pages, pos={8, 8}, size={300, 200}, proc=TabChanged
TabControl pages, tabLabel(0)="Data", tabLabel(1)="Fit", value=0
End
Function TabChanged(STRUCT WMTabControlAction &tca) : TabControl
if (tca.eventCode != 2)
return 0
endif
Variable page = tca.tab
Button runBtn, win=$tca.win, disable=(page == 0 ? 0 : 1)
SetVariable thrSet, win=$tca.win, disable=(page == 1 ? 0 : 1)
return 0
End
How it works
TabControldraws the tabs; it does not move anything.- The action gets the new tab, and you set
disableon each page's controls. - Naming controls by page makes that loop short.
Keywords and builtins used here
ButtonEndFunctionSTRUCTSetVariableTabControlVariableendififprocreturn
The run, in numbers
- Lines
- 15
- Characters to type
- 412
- Tokens
- 117
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 83 seconds.
Step 3 of 4 in Bigger controls, step 11 of 18 in Panels & GUI.